[英]ORMLite Foreign field class does not have id field
在有关此问题的其他问题上,我也看到了完全相同的错误。 如您所见,看来我没有错! 除非我的眼睛一直在欺骗我。 有什么帮助吗?
这是我的两个模型:
public class Outer {
@DatabaseField(id = true, canBeNull = false, columnName = "id")
private int id;
@DatabaseField
private long parentOuterId;
@ForeignCollectionField(eager = false)
private ForeignCollection<Item> items;
//getters and setters
}
public class Item {
@DatabaseField(canBeNull = false, columnName = "id")
private int id;
@DatabaseField(canBeNull = false, foreign = true, foreignAutoRefresh = true)
private Outer out;
//getters and setters
}
您忘记为@DatabaseField
批注添加id = true
或generatedId = true
:
@DatabaseField(id = true, canBeNull = false, columnName = "id")
private int id;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.