Question

Does ORMLite 4.47 support embedded objects? Getting an exception while trying to run a DAO test for an entity dao:

java.lang.IllegalArgumentException: ORMLite does not know how to store class com.abc.def.Pqr for field pqr. Use another class or a custom persister. at com.j256.ormlite.field.FieldType.(FieldType.java:189) at com.j256.ormlite.field.FieldType.createFieldType(FieldType.java:939)

@DatabaseTable(tableName = "XYZ")
public class Xyz
{
    @DatabaseField(columnName = "ID", canBeNull = false)
    private String id;

    @DatabaseField(columnName = "PQR")
    private Pqr pqr;

    ... 
}

@DatabaseTable(tableName = "PQR")
public class Pqr
{
    @DatabaseField(columnName = "ID", canBeNull = false)
    private String id;

    @DatabaseField(columnName = "ZZZ")
    private Zzz zzz;

    ... 
}

@DatabaseTable(tableName = "ZZZ")
public class Zzz
{
    @DatabaseField(columnName = "ID", canBeNull = false)
    private String id;

    @DatabaseField(columnName = "NAME")
    private String name;

    ... 
}

pqr and zzz are embedded objects.

Was it helpful?

Solution

Does ORMLite 4.47 support embedded objects? Getting an exception while trying to run a DAO test for an entity dao:

Unfortunately as of September 2019 the answer is no, it doesn't. You will have to use foreign objects if you want to associate multiple classes.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top