-->
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: Can I change the 'laziness' setting at query level?
PostPosted: Wed Oct 26, 2011 3:19 pm 
Newbie

Joined: Fri Sep 14, 2007 2:02 pm
Posts: 10
Location: New York, NY
Hi,

Ever since Hibernate 3, associations have been lazy by default. I have a code base with a pretty extensive set of data objects, with virtually every association modeled as non-lazy, and I'm looking in to changing that because I want to interact with Hibernate in a more standard way.

The reason we do this is because there's two basic use cases in our application. One works well with lazy associations: there's a Session available, and we can rely on Hibernate to fetch things when needed. The other doesn't: objects need to be read completely, and sent elsewhere. They'll be used at some later date at a time when there is no Session available (or perhaps even a database connection at all), and therefore must have all their associations loaded right now, even though that's going to be many individual SQL queries.

The way I think about this, that means that I'd want to request an object from a session, and say 'load completely', which would force non-lazy initialization for every association. As far as I know, there's now way to do this at the query level, but I'm hoping that someone here knows different?

Thanks,

Chris


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.