Support association with a model has custom type primary key
Closed this issue · 3 comments
sakuna63 commented
Example:
If we have following model definitions
@Table
class Parent {
@PrimaryKey
public CustomKey customKey;
}
@Table
class Child {
@PrimaryKey
public long id;
@Column
Parent parent;
}
class CustomKey {
// ...
}
@StaticTypeAdapter(targetType = CustomKey.class, serializedType = String.class)
class CustomeKeyAdapter {
// ...
}
Generated AssociationDef
should use serialized customKey
by CustomeKeyAdapter, but actually it attempts to use raw customeKey
like a below
class Child_Scheme {
// ...
public final AssociationDef<Child, Parent, Parent_Schema> parent;
this.parent = new AssociationDef<Child, Parent, Parent_Schema> ... {
// ...
@NonNull
@Override
public String getSerialized(@NonNull Child model) {
return model.parnet.customKey; // customKey should be serialized here by CustomeKeyAdpater!!!
}
// ...
};
}
Whould you have any plan to support this feature?
Thanks.
sakuna63 commented
Thanks!! 🙏
gfx commented
Released v4.1.1 including this fix. Thanks for the report! 🎆