-->
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.  [ 5 posts ] 
Author Message
 Post subject: Hibernate initialise
PostPosted: Thu Apr 26, 2007 11:29 pm 
Newbie

Joined: Thu Apr 26, 2007 11:25 pm
Posts: 5
Whenever i retrieve a list of data from the db, i will hibernate initialize all of it, then close session, then only display it.

This become a problem when i have a lot of data, say for eg, 2000++, After i retrieve the 2000++ data, i will have a for loop, looping these data and perform hibernate initialize. If i don't initialize, i will have the proxy error after i close the session and display.

Is there any other way to do this, without looping all the data for initiliazing?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 27, 2007 8:37 am 
Expert
Expert

Joined: Tue Jul 11, 2006 10:21 am
Posts: 457
Location: Columbus, Ohio
http://www.hibernate.org/315.html


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 30, 2007 2:44 am 
Newbie

Joined: Thu Apr 26, 2007 11:25 pm
Posts: 5
Hi, thanks for the link.

i've tried the fetch="subselect" but it still requires me to hibernate.initialize the collection after the session closed.

is there anyway to just initialize without looping all the data retrieved?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 30, 2007 8:05 am 
Expert
Expert

Joined: Tue Jul 11, 2006 10:21 am
Posts: 457
Location: Columbus, Ohio
Post the manner and code in which you are retrieving the data (HQL, Criteria, etc).


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 02, 2007 9:49 pm 
Newbie

Joined: Thu Apr 26, 2007 11:25 pm
Posts: 5
Hi, i managed to solve the problem by using fetch="join". It doesn't need hibernate.initialize!!

Thanks.


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