-->
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.  [ 4 posts ] 
Author Message
 Post subject: Lazy-load associations but not result of Session.load()
PostPosted: Mon Feb 02, 2009 3:49 pm 
Newbie

Joined: Wed Oct 01, 2008 2:27 pm
Posts: 18
Objects returned from Session.load() appear to be lazy-loading proxies. This is problematic for me as Hibernate does not even check that the returned object exists (until a property of the object is accessed). Is it possible to disable this behavior at the application level, without also disabling all the collection and association lazy-loading (which is less problematic because failures are less likely)? I'm aware that I could replace all calls to Session.load with Session.get and do an explicit null check, but I'm wondering if there is another way...


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 02, 2009 4:31 pm 
Senior
Senior

Joined: Thu Jan 08, 2009 3:48 pm
Posts: 168
Manual says this behaviour is intended, you should only use load if you know for sure the ID exists


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 02, 2009 6:30 pm 
Regular
Regular

Joined: Tue Dec 30, 2008 8:14 pm
Posts: 50
Can you set the lazy=false for the top level object alone.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 02, 2009 10:37 pm 
Newbie

Joined: Wed Oct 01, 2008 2:27 pm
Posts: 18
lazy=false on each class might work -- though I was hoping for a global configuration setting... And this won't prevent lazy association (and collection) loading, will it?


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

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.