How do I select a collection of objects and pass it to a bean as a parameter using EJBQL?
I am doing some strange posts from the JPA datastore.
I need to select (using EJBQL) a list of objects. These objects contain a collection of objects. I have a class that builds on:
FOOBean(String param1,
String param2,
List<Entity> listParam)
(note that the third parameter is a list)
And I want to select a list of these beans using GROUP BY
, fetch listParam
, so I would like to write a query that works like this:
SELECT new FOOBean(
e1.param1,
e1.param2,
e1)
FROM Entity e1
GROUP BY e1.param1, e1.param2
Thus, the grouped objects are selected in the list and inserted into the third parameter. Is it possible to do this or do I need to create two queries that select separate pairs param1
and param2
; and selects all objects with corresponding parameter values respectively?
a source to share