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.  [ 3 posts ] 
Author Message
 Post subject: Spring HibernateDaoSupport without OSIV
PostPosted: Tue May 19, 2009 1:28 pm 
Beginner
Beginner

Joined: Tue Feb 03, 2009 4:33 pm
Posts: 21
I'm trying to develop a Quartz job scheduler app, using Spring's HibernateDaoSupport.

Basically, I've developed a DAO package (jar), using HibernateDaoSupport, that works perfectly when I use it in a Spring MVC app, with an OSIV interceptor, but when I try to use it in any other Spring-configured application (such as my Quartz scheduler), I get LazyInitializationExceptions any time I try to access a proxied property.
Normally, I would post this in the Spring developer forums, but noone there seems to have an answer. Has anyone here managed to use HibernateDaoSupport, and how did you overcome the (seemingly inevitable) LIE exceptions? I've been trying to figure this out for weeks now, with no luck...

Please help, if you can. I may have to kill myself.


Top
 Profile  
 
 Post subject: Re: Spring HibernateDaoSupport without OSIV
PostPosted: Tue May 19, 2009 4:16 pm 
Newbie

Joined: Fri Feb 08, 2008 2:41 pm
Posts: 18
This is because you are trying to access proxies while the session is already closed.

What you could do is the following:
Let quarts call a transactional method from a service object. From within this method you call your dao's.
The session will not close if the service method is transactional!


Top
 Profile  
 
 Post subject: Re: Spring HibernateDaoSupport without OSIV
PostPosted: Tue May 19, 2009 10:16 pm 
Senior
Senior

Joined: Wed Sep 19, 2007 9:31 pm
Posts: 191
Location: Khuntien (Indonesia)
Hi,

Try to initialize the property by calling Hibernate.initiliaze(Object) before leaving from DAO


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