转:http://stackoverflow.com/questions/15250609/greendao-primary-key-on-multiple-columns
Does GreenDAO support primary key on multiple columns?
I'm using Property
's method primaryKey()
on two columns but it doesn't work. I'm getting exception:
Caused by: android.database.sqlite.SQLiteException: table "table" has more than one primary key
How to create primary key on multiple columns? Should I edit generated DAO classes?
=======================================================================
The documentation says:
Currently, entities must have a long or Long property as their primary key. [...] To work around this issue, you can use a long primary key and use an unique index for the intended “key” properties.