GreenDao deleting a row in a junction table
質問
I have a junction table | USER_ID | ORDER_ID |
now, when I'm trying to delete a row in the table I'm getting
does not have a single-column primary key
error.
Now of course both of the table's columns are FK, and I can't add a PK column in it because it's a junction table.
I'm using :
userJoinOrdersDao.delete(userOrderObj);
Does anyone see my mistake?
解決
The junction table's primary key consists of both columns. This is not supported by greenDAO.
http://greendao-orm.com/documentation/relations/ says:
While greenDAO does not support n:m relations directly as of now, you can model the join table as a separate entity.
... which would require a separate PK column.
Does an order really need to have multiple users?
所属していません StackOverflow