我有一个简单的主从细节,当我查询de master并检查外部成员集合时,抛出异常java.lang.IllegalStateException: Could not build lazy iterator for class com.example.entity.detail
List<Master> masters = DBHelper.getMasterDao().queryForAll();
此时,可以很好地检索主节点,但尝试访问该外部成员时将引发异常。
类定义
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;
}
这是我遇到的错误。我只是仔细查看了堆栈跟踪并发现了问题。