Urmech wrote:
Hi, without the GroupInfo class, I can't tell you. But keep in mind that one2one and Many2one relations are fetched eager by default. If you don't want this behaviour, just force lazy. (E.g. with
Code:
@Basic(fetch = FetchType.LAZY)
)
You can eliminate multiple results with:
Code:
q.setResultTransformer(CriteriaSpecification.DISTINCT_ROOT_ENTITY);
Greetings Michael
Thanks for your input. I, however, am unsure it is related with the fetch type. The multiple queries is not on the its child class at all. It is about class hierarchy, but not parent-child relationship.
Here is the two queries generated by the single HQL:
Code:
Hibernate:
select
eventinfo0_.id as id26_,
eventinfo0_.ending as ending26_,
eventinfo0_.group_fk as group13_26_,
eventinfo0_.name as name26_,
eventinfo0_.starting as starting26_
from
se_event eventinfo0_
where
eventinfo0_.group_fk=?
and eventinfo0_.starting>=?
order by
eventinfo0_.starting desc
Hibernate:
select
event0_.id as id26_,
event0_.ending as ending26_,
event0_.group_fk as group13_26_,
event0_.name as name26_,
event0_.starting as starting26_,
event0_.access as access26_,
event0_.description as descript8_26_,
event0_.fee as fee26_,
event0_.limitation as limitation26_,
event0_.location as location26_,
event0_.ORGANIZER_FK as ORGANIZER14_26_,
event0_.status as status26_
from
se_event event0_
where
event0_.group_fk=?
and event0_.starting>=?
order by
event0_.starting desc