0

I am using TableUtils to generate my tables with ORMLite. Everything is working just fine if I use ORMLite for all operations. However, when I try to perform a join query using something else, it complains about missing foreign key relationship.

If I look in the database, I can see that the column is not set to be a foreign key.

I defined the relationship using the following annotation:

@DatabaseField(canBeNull = true, foreign = true, foreignAutoCreate = true, foreignAutoRefresh = true, foreignColumnName="id")
protected CoatedSampleEntity coatedSample;

Is there anyway to get the TableUtil to flag this fields as a foreign key when I generate the tables?

Thanks for your time!

4

1 回答 1

0

不幸的是,截至 2013 年 5 月,答案是否定的。ORMLite 不支持外键约束。@DatabaseField(columnDefinition("..."))您可以使用该字段自己设置它们。

于 2013-05-23T19:28:56.397 回答