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 Loading using API
PostPosted: Fri Oct 27, 2006 4:28 pm 
Beginner
Beginner

Joined: Thu Aug 31, 2006 2:31 pm
Posts: 25
Location: USA
Hi All,
Is there any way I can turn Lazy loading on / off using Hibernate API ?
I have a application which will load all the collections (no lazy loading).But now i have add a findAll method which needs to return the list of parent object only.It does not need to load all dependent objects.How to do this ?
When i load using hibernate it loads all dependent objects also.I dont want to change in the Mapping file.

Thanks,
Vinodh

_________________
I am using a shitty e-mail filtering system that caused a lot of bounces for the admin of this forum. I need to turn on my brain next time and update my e-mail address.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Oct 28, 2006 2:57 pm 
Expert
Expert

Joined: Sat Oct 25, 2003 8:49 am
Posts: 490
Location: Vrhnika, Slovenia
Leave it as default - lazy.
Then you can set on query / criteria setFetchMode(<association>, FetchMode.EAGER).


Top
 Profile  
 
 Post subject: Lazy Loading using API
PostPosted: Mon Oct 30, 2006 9:33 am 
Beginner
Beginner

Joined: Thu Aug 31, 2006 2:31 pm
Posts: 25
Location: USA
Well I cannot the change the exisiting mapping which is mapped with lazy=true. So i would like to do the loading using API .Like Loading using Eager will fecth all dependent objects right , Is there a way i can set some to load lazily too ?
Thanks,
Vinodh

_________________
I am using a shitty e-mail filtering system that caused a lot of bounces for the admin of this forum. I need to turn on my brain next time and update my e-mail address.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 30, 2006 9:44 am 
Senior
Senior

Joined: Tue Jul 25, 2006 9:05 am
Posts: 163
Location: Stuttgart/Karlsruhe, Germany
Assuming you are using EJB3.0, why don't you just modify the EJBQL queries (hopefully you are using these).

When you require eager loading use fetch joins, but when that is not needed and lazy loading will be good enough just use standard joins.

Andy


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.