Insoft
Insoft

Reputation: 548

get values from 2 different entities with greendao 3

Problem: How I can get 2 values from 2 different tables? I'm replacing android Content Provider with greenDao. With Content provider you can define a sql view but this is not possible with greenDao. So I tried to use joins but greenDao return me only one list entity.

What is the best method in greenDao to get 2 values from 2 different entities?

Example:

 |Table a|                            | Table b |

 | id | descr | b_Id |                |  id   | hues | hex |
 |  1 | place |  1   |                |   1   |   2  | #000|
 |  2 | sea   |  1   |                |   2   |   3  | #111| 
 |  3 | name  |  2   |                ...
 ...                                  ...

How can I get the following object or similar? C c = new C(d.getDescr(), d.getHex());

thanks in advance.

Upvotes: 2

Views: 663

Answers (1)

Markus Junginger
Markus Junginger

Reputation: 7090

Consider using relations. If you have an object a, you could get b via a.getB().

Upvotes: 2

Related Questions