-->
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: Lazy loading without open Session - performance issue
PostPosted: Tue Jun 08, 2004 7:37 am 
Newbie

Joined: Tue Jun 08, 2004 6:49 am
Posts: 2
Hi,

We are using Hibernate for a web application using Oracle 10g as the appn server and Oracle 9.0.2 as the database. We are using Hibernate2.

There are many related objects and thereby, lazy loading is an imp feature which we would want to use. There is a problem in using it by keeping the session open till all the values are loaded. If we do not use lazy loading, then it loads all the objects and thereby the system is very slow and runs out of memory and we need to restart the appn server.

We want to close the session immediately after use. At the same time, want lazy loading feature. We did go thru some of the queries and found the following block in your site.

-----------------------------------------------------------------------------------
Do I have to keep the Session open if I want to use lazy initalization?
Pick one:

Have to keep the Session open (several strategies) until all lazily loaded collections/proxies have been loaded because they have been called.

************* We don't want to keep the session open till all values are accessed ***************

Eagerly fetch all required data with an HQL query before closing the Session.

*********** We are not using HQL *****************************

Reattach, by calling lock() or update() (see the API documentation) a Detached Object (you don't have to do anything special for that) to a new (second) Session when a view that is rendered accesses a lazily loaded property.

************************************************************
Plz let know how the above can be used with small piece of code.

Is it possible to close the session after use and when lazy loading happens, it can load values generating a session if one is not available.


************************************************************

Initialize all (by the specific application use case) required lazy collections and proxies manually with initialize() before you close the Session.

********************This is not using lazy loading which is not a feasible solution as the appn is very slow with all objects loaded ********************
----------------------------------------------------------------------------------

Your help is appreciated.

Thanks and Regards.
Deivanai


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 08, 2004 7:57 am 
Newbie

Joined: Tue Jun 08, 2004 6:49 am
Posts: 2
Adding to the same question, say we disconnect the session instead of closing it. Then we need to reconnect for lazy loading. But the access will be at a different layer for the reference of the lazy loaded object and will not know anything about the session object. How do we approach this issue?


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.