GreenDao Many to Many Relation

前端 未结 1 1420
野趣味
野趣味 2021-01-20 17:11

I use Greendao for my database mapping in Android. So far everything works great.

But now I have the following problem:

I have a Cluster and leaf Objects. A

相关标签:
1条回答
  • 2021-01-20 17:46

    Let's start with a quote from the docs:

    While greenDAO does not support n:m relations directly as of now, you can model the join table as a separate entity. In practice, you often have “relation entities” with additional properties, so you might want to do so anyway. In future releases, greenDAO might introduce direct support of n:m relations.

    So, in your case you have to model an entity, that is between Cluster and Leaf. Let's call this entity ClusterLeaf. To query leafs for a cluster efficiently, I'd suggest raw queries because the QueryBuilder does not support joins yet.

    0 讨论(0)
提交回复
热议问题