mardi 30 juin 2015

Could not build lazy iterator for class of Foreing collection member

I have a simple master-detail, when I quey for de master and inspect for the foreign member collection, throw an exception java.lang.IllegalStateException: Could not build lazy iterator for class com.example.entity.detail

List<Master> masters = DBHelper.getMasterDao().queryForAll();

At this point, masters are retrieved fine but at try to access to the foreign member throws the exception.

Class definition

public class Master {

    public Master(){

    }

    @DatabaseField(id = true)
    public int Id;

    @DatabaseField(format = "yyyy-MM-dd'T'HH:mm:ss", dataType = DataType.DATE_STRING)
    public Date CreationDate;

    // Reverse navigation
    @ForeignCollectionField(eager = true)
    public Collection<detail> details;
}

public class Detail{

    @DatabaseField(id = true)
    public long Id;
    @DatabaseField
    public int Month;
    @DatabaseField
    public double Price;
    @DatabaseField
    public double Diff;

    @DatabaseField(canBeNull = true, foreign = true)
    public Master master;


}

Aucun commentaire:

Enregistrer un commentaire