Hi Litty,
first of all, thanks for your response!
littypreethkr wrote:
May be you can use a HQL like:
Code:
"select propertyName from EntityClass where id in (1,2,3,4)"
This is indeed what I want to achieve but if I execute this query and subsequently I access the loaded property on any of the root objects specified in the query, Hibernate nevertheless triggers another query in order to load the
same collection.
Somehow, it seems that Hibernate does not associate the loaded collections with their respective root objects. Or am I doing something wrong? I'm using version 3.2.6.GA of Hibernate.
What actually seems to work is a HQL query like the following:
Code:
from EntityClass e left join fetch e.propertyName where e.id in (1,2,3,4)
However, the problem here is that the query always returns the root object as well (for every entry of the collection) which I want to avoid since I already have the root objects loaded and I want to load
multiple collections for all the root objects so this way I would retrieve lots of redundant data from the database.