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 Exception
PostPosted: Sun Nov 19, 2006 6:38 pm 
Newbie

Joined: Thu Nov 09, 2006 1:00 pm
Posts: 5
Hi,

I am really stuck with this problem since 2 days. I have Dao and bean classes which is shared by a web application and a client application. I need to lazy load and was getting lazy intitialization exception in web. I finallly used the OpenSessionInViewInterceptor in web and that is working now. But i have not been able to find out how to do the same in the client application.

Can someone pls provide me some resources or sample code.. I am really stuck.

Thanks in advance.

Prasanth


Top
 Profile  
 
 Post subject:
PostPosted: Sun Nov 19, 2006 6:40 pm 
Newbie

Joined: Thu Nov 09, 2006 1:00 pm
Posts: 5
Forgot to mention that i'm using getHibernateTemplate in DAO.

Thx


Top
 Profile  
 
 Post subject:
PostPosted: Sun Nov 19, 2006 11:21 pm 
Senior
Senior

Joined: Tue Aug 23, 2005 8:52 am
Posts: 181
OpenSessionInView will keep your Session open from the initial time a request came in till the response is served. Thats the reason LazyInit Errors dont come anywhere. If you want the same in your client application, the session that was used for loading your object should be available wherever the objects are getting loaded (later in the code) or use Hibernate.initialize.
The Hiberntae FAQ has lots of info about this as well as these forums. Try a few searches.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 20, 2006 5:23 pm 
Newbie

Joined: Thu Nov 09, 2006 1:00 pm
Posts: 5
Thanks for the reply..
I am able to get the lazy loading working when i use Session in my DAO. But when i use HibernateTemplate, it seems to be not working..
I did quite a lot of reading on this. I tried the Hibernate.initialize() also, but that's not working..
Could you please give some thoughts on this

Thanks,
Prasanth


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.