我在android中使用ormlite来保存我的数据。 我有这个错误:
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.firext.android/com.firext.android.activities.reportList.ReportListActivity}: java.lang.RuntimeException: java.sql.SQLException: Foreign collection class com.firext.android.model.bbdd.DBQuestionsGroup for field 'questionsGroup' column-name does not contain a foreign field named 'questionsGroupsList' of class com.firext.android.model.bbdd.DBQuestions
我的课就是这个;
@DatabaseTable
public class DBQuestionsGroup {
@DatabaseField(generatedId = true, columnName = "_id")
private Long ID;
@DatabaseField(columnName = "times")
private int times;
@DatabaseField(columnName = "idQuestionsGroup")
private int idQuestionsGroup;
@DatabaseField(columnName = "nameQuestionsGroup")
private String nameQuestionsGroup;
@ForeignCollectionField
private Collection<DBQuestion> questionsGroupsList;
getters and setter
@DatabaseTable
public class DBQuestion {
@DatabaseField(generatedId = true, columnName = "_id")
private int ID;
@DatabaseField(columnName = "question")
private String question;
@DatabaseField(columnName = "questionOrder")
private int questionOrder;
@DatabaseField(foreign = true,foreignAutoCreate = true)
private DBReplieType replyType;
@DatabaseField(columnName = "idQuestion")
private int idQuestion;
@DatabaseField(foreign = true, foreignAutoRefresh= true)
private DBQuestionsGroup DBQuestion;
问题是什么?
答案 0 :(得分:0)
也许您需要以这种方式在DBQuestionsGroup类中设置ForeingCollection:
@ForeignCollectionField
private ForeignCollection<DBQuestion> questionsGroupsList;