-->
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: is lazy collection really the default?
PostPosted: Tue May 29, 2007 6:08 pm 
Beginner
Beginner

Joined: Thu May 17, 2007 2:41 pm
Posts: 48
I am reading two things about lazy initialization which seem to conflict.

First, I defined many collection mapping without specifying lazy="false", because I understand that is the default. During run time, I find out I am getting LazyInitializationException when accessing the collection. Then I read you should call Hibernate.initialize(n.getChildren()) to make sure the collection is fetched.

Why didn't lazy default to false to start with? Do I really need to resort to Hibernate.initialize(getChildren()) each time?


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 29, 2007 6:52 pm 
Beginner
Beginner

Joined: Thu May 17, 2007 2:41 pm
Posts: 48
ok, must have read an old doc.

hibernate 3 has
Since it is best practice to map almost all classes and collections using lazy="true", that is now the default.


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 30, 2007 4:17 am 
Expert
Expert

Joined: Tue Aug 23, 2005 5:52 am
Posts: 335
NHibernate 1.0.x defaults to lazy = false while NHibernate 1.2.x defaults to lazy = true.

Symon.


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.