Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 758
Ziem Avatar asked Mar 06 '13 14:03

Ziem


1 Answers

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.

like image 100
CL. Avatar answered Sep 28 '22 06:09

CL.