-->
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: EJB and Hibernate Session lazy problem
PostPosted: Thu Oct 06, 2005 10:45 am 
Newbie

Joined: Thu Oct 06, 2005 10:24 am
Posts: 1
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version: Hibernate 3


Hi, we are developing a web application with Hibernate 3, Websphere and EJB 2.1 (stateless session EJB) and we have a problem with the Hibernate session.

The problem is that if we want to access a lazy relationship in the web view, we get de LazyInitializationException because the session is closed. We are using a Filter that takes care of the session and it doesn´t close it until the view is totally rendered, but it doesn´t work.


We think the reason is that CMT transaction manager closes the session automatically when a transaction finishes and when accesing the session in view to acces a lazy relationship, it has been previously closed.

Any suggestions??


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 06, 2005 11:08 am 
CGLIB Developer
CGLIB Developer

Joined: Thu Aug 28, 2003 1:44 pm
Posts: 1217
Location: Vilnius, Lithuania
As I understand you must use statefull beans and to demarcate trasactions in filter yourself (UserTransaction) to access lazy relationship in view.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 06, 2005 2:20 pm 
Newbie

Joined: Wed Mar 30, 2005 8:58 am
Posts: 10
Location: São Paulo / Brazil
Maybe that's not the best approach.

I believe I'm not the only one who thinks that the programmer should (or must!) initialize what is needed to be showed in view layer.

See sections 8.1.* in Hibernate In Action for more info.

[]'s

_________________
www.brunoborges.com.br


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.