I try to user ORMLite with Parceler, but Parceler catch an error:
Error:(44, 36) error: Parceler: Unable to find read/write generator for type com.j256.ormlite.dao.ForeignCollection<PassKeyItem> for CategoryItem.passKeyItems
Here is my objects:
CategoryItem.class
@Parcel
@DatabaseTable(tableName = "categories")
public class CategoryItem {
...
@ForeignCollectionField(columnName = FIELD_PASS_KEY_ITEMS)
ForeignCollection<PassKeyItem> passKeyItems;
}
PassKeyItem.class
@Parcel
@DatabaseTable(tableName = "passkey")
public class PassKeyItem {
...
@DatabaseField(foreign = true, foreignAutoRefresh = true, columnName = FIELD_CATEGORY_ITEM_ID)
private CategoryItem categoryItem;
}
You need to supply a converter, because Parceler doesn't know how to serialize a
ForeignCollection
.Here's an example from the documentation:
More information at https://github.com/johncarl81/parceler#custom-serialization