-->
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.  [ 3 posts ] 
Author Message
 Post subject: How to fully prevent lazy fetching?
PostPosted: Sat Dec 13, 2008 12:41 pm 
Newbie

Joined: Thu Apr 28, 2005 6:48 am
Posts: 12
Location: Finland
Hello,

Is it possible to tell Hibernate not use lazy fetching at all, so that association attributes are left null?

In some situations I need some associations to be loaded, in those situations I would explicitly tell Hibernate to load them.


Thank you


Top
 Profile  
 
 Post subject: Re: How to fully prevent lazy fetching?
PostPosted: Sun Dec 14, 2008 5:29 am 
Newbie

Joined: Fri Jun 06, 2008 2:03 pm
Posts: 9
ksurakka wrote:
Hello,

Is it possible to tell Hibernate not use lazy fetching at all, so that association attributes are left null?

Are you referring to lazy fetch of the entity or the entity attribute?

You can define both the class as well as the class attribute not to use lazy fetch

Use lazy="false". Use this as a reference.

http://www.hibernate.org/hib_docs/refer ... pping.html

In some situations I need some associations to be loaded, in those situations I would explicitly tell Hibernate to load them.

You can use Session.get(...) to load them


Thank you


Are


Top
 Profile  
 
 Post subject:
PostPosted: Mon Dec 15, 2008 3:37 am 
Senior
Senior

Joined: Wed Sep 19, 2007 9:31 pm
Posts: 191
Location: Khuntien (Indonesia)
You can use Hibernate.initialize(object) to initilize the property


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.