greenrobot / greenDAO

greenDAO is a light & fast ORM solution for Android that maps objects to SQLite databases.
http://greenrobot.org/greendao/
12.63k stars 2.89k forks source link

How can an entity created a list of different name's tables ? #455

Closed jaydenyuhy closed 7 years ago

jaydenyuhy commented 7 years ago

If I have a message entity, I want to create a message table whose name is "messagefromAToB" when a userA chat to a userB, and create a message table whose name is "messagefromAToC" when a userA chat to a userC; How can I achieve this by greenDao?

greenrobot-team commented 7 years ago

greenDAO works based on the notion that there is one table per entity. If you want different tables you have to create different entities.

In your case I suggest you use one table/entity and add some identifiers, like the sender and receiver, to the entity to allow querying for the messages between certain users. -ut

jaydenyuhy commented 7 years ago

For some reason I want to use a different name's table to distinguish between different objects, such as chat records synchronization;Do greenDao have plans to implement one entity corresponding to multiple tables?