These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: HQL query returns proxies even when with "left join fet
PostPosted: Tue Jul 17, 2007 8:49 pm 
Newbie

Joined: Thu Jun 02, 2005 10:58 pm
Posts: 5
Hi All,

I use HQL extensively in our data access layer to build business objects and pass them back to the business services layer.

As we can only eagerly load one collection per HQL query, I have to perform a number of HQL queries to eagerly load the collections that I need.

As the object I'm building up is in the first level Hibernate cache, each HQL query builds up the object tree in the cache. I can then pass this object back from my Data Access Layer and it is fantastic.

The only problem is when an object is indirectly loaded by an earlier HQL query and it is stored in the Hibernate cache as a proxy. Any subsequent HQL query returns a proxy even when I specify a "left join fetch".

The only way I can get around this is to ensure that I anticipate these situations and re-order the HQL to eagerly load the objects in earlier HQL queries.

This solution is not ideal from a maintainability point of view (e.g. having to re-structure hql for every new requirement is time consuming and prone to error).

Apart from doing evicts or immediate loads, do you guys know of any other solutions to this?

Thanks for your help.

Regards,
Gaj


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.