IN EJB-QL I am trying to create a query like this:
SELECT *
FROM table
WHERE id IN ([id1],[id2],[id3],...);
This is a normal query for oracle or mysql but how can I make EJB-QL set parameters as a list?
SELECT o
FROM ClassName
WHERE ClassNameId IN (List<Long> listOfIds);
is there a way to do this?
More importantly is would this be more efficient then running a separate query for each id in the list?
Any suggestions would be appreciated.
Edit: For clarity I am trying to run one query to return multiple rows based on a list of ids (not the entire table, not the contents of another table, but an arbitrary list of ids). I am hoping to be able to run this query once instead of running a normal find query multiple times (once for each of the ids in the list).
Thanks,
Jim