Nobody
Nobody

Reputation: 60

Room changing ids on join query

So we are using room library and it's easy to use but we have a problem it apperise like room is changing the ids of the objects when we use join queries.

@Query("select * from puzzles inner join list_puzzle_join on puzzles.id=list_puzzle_join.puzzleId where list_puzzle_join.puzzleListId=:puzzleListId")

List<Puzzle> getAllPuzzlesFromPuzzleList(String puzzleListId);

for example when we get puzzles Using the puzzlesDAO we get this ids :

6c6a5f74-d5bb-45c5-922b-b95bf608854c ,
03e34887-0d7d-4b6f-85d4-0a38ce3c0da9 ,
a9ac3435-cd35-4f7c-8bd3-e91b5514ecd2 ,

and when we use the join query we get :

2ba31014-f105-4f15-be01-f167b9afef55 ,
a23a48de-7552-4b27-a49c-369c3949f45c ,
4b9034a2-4936-4741-9448-6c57855cee6a ,

is it possible to get the correct its or is it like this by design??

Upvotes: 0

Views: 74

Answers (1)

reTs
reTs

Reputation: 1829

I think what you want to do is select puzzles.* but not select *. The query you are using now is likely to have 2 id field, which probably is the root cause.

Upvotes: 1

Related Questions