-->
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.  [ 2 posts ] 
Author Message
 Post subject: dynamically enable/disable lazy loading?
PostPosted: Wed Mar 19, 2008 6:46 pm 
Newbie

Joined: Tue Jan 29, 2008 6:07 pm
Posts: 5
I would like to be able to programmatically enable/disable lazy loading at a certain table level. Normally, I prefer lazy loading. However, there are certain scenarios where I need to disable it for a Session (or a Transaction or .execute() call if necessary).

Is there a way to do this? If not, what is the recommend method of doing this?

Scenario:
In a certain query, I want to get a list of rows from TableA immediately (i.e. NOT lazily) -- without having to traverse through them, similar to how Hibernate 2 did it.
Later on, I want a different query to lazily get data from TableA and below.

Summary of table relationships:
Code:
TableA
  TableB one-to-one
  TableC one-to-many (set)
    TableD one-to-many (set)


Hibernate 3.1.3
Java 1.5


Top
 Profile  
 
 Post subject: Re: dynamically enable/disable lazy loading?
PostPosted: Wed Mar 19, 2008 7:16 pm 
Expert
Expert

Joined: Wed Apr 11, 2007 11:39 am
Posts: 735
Location: Montreal, QC
You could use fetch joins whenever needed. That would initialize collections without considering any lazy loading settings.


Farzad-


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