Reputation: 14930
We have a series of objects each one with a unique id (dbId
). Given a list of DBIDs we want to retrieve the corresponding objects.
We tried with (JPQL):
SELECT myObject FROM MyObject WHERE myObject.dbId IN ( listOfDbIds )
We get the list of objects but the query (as expected) does not retain the order.
Do we really have to sort the results according the order of the original list or is there a better way?
Upvotes: 0
Views: 140
Reputation: 691765
I don't see any other way. Guava's explicit ordering would be helpful in this case.
Upvotes: 2