-->
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.  [ 7 posts ] 
Author Message
 Post subject: HibernateUtil, ThreadLocal...and WebSphere (v5)
PostPosted: Thu Oct 06, 2005 12:49 am 
Newbie

Joined: Mon Oct 03, 2005 8:37 am
Posts: 6
Location: Charlotte, NC
Hibernate version: 2.1.6

Name and version of the database you are using: Oracle 9i

I'm sure some folks here have seen this article regarding the use of ThreadLocal and WebSphere:
http://www.devwebsphere.com/devwebspher ... hread.html

I am using HibernateUtil (and long sessions) in it's original from (i.e. from the Hibernate In Action book) and am concerned about this. Any suggestions about the best way to address this problem? I suppose I could convert everything into stateful session Beans, but that seems a little extreme. Any suggestions or input would be greatly appreciated.


Top
 Profile  
 
 Post subject: Maybe this is the solution
PostPosted: Thu Oct 06, 2005 1:11 am 
Newbie

Joined: Mon Oct 03, 2005 8:37 am
Posts: 6
Location: Charlotte, NC
Found this by Christian, it appears to apply, just not sure how to fit it all together. Maybe need to Hibernate 3 to do this?

http://blog.hibernate.org/cgi-bin/blosx ... ntext.html


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 06, 2005 1:18 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
We are currently updating this part. There is no good built-in way in Hibernate to do Long Session per Application Transaction (Conversation) with a JTA environment. There will be a better solution available next week, with updates to the documentation and website.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 06, 2005 1:19 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
And yes, this is all Hibernate 3.(1). You should definitely upgrade.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 06, 2005 8:42 am 
Newbie

Joined: Mon Oct 03, 2005 8:37 am
Posts: 6
Location: Charlotte, NC
Christian,
Thanks for taking the time to repond. I'm amazed the Hibernate team can eak out the time to even look here.

Actually I am not using JTA but was hoping to find an alternative to ThreadLocal for storing the Hibernate session (based on the warning about TreadLocal WebSphere in the earlier link I posted). I thought maybe ThreadLocalSessionContext was what I was looking for but I don't think so now. Also I'm not on the EJB 3.0 container yet (WebSphere 5.x is EJB 2.0) It's looking like SFSB may be the option.

Thanks a again for the help.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 06, 2005 8:49 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
The new option I was talking will enable you to bind a Session to the current JTA transaction, which is the right mechanism for an EJB container. The thread-binding is supposed to deliver the same programming model for non-JTA environments.


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

Joined: Mon Oct 03, 2005 8:37 am
Posts: 6
Location: Charlotte, NC
I apologize for my ignorance here.
I thought that the JTA was only invovled when using CMTs or BMTs in the context of an EJB. I am not using an EJB, just servlets and the DAO pattern. So I thought this would only have involved local transactions. But apparently I've misunderstood. Based on your comments, I tried to research more and found this on the IBM site:

"BMT enterprise beans, application client components, and web components can use the Java Transaction API (JTA) UserTransaction interface to define the demarcation of a global transaction. The UserTransaction interface can be obtained by a JNDI lookup of java:comp/UserTransaction or from the SessionContext object using the getUserTransaction method.."

So what you said "bind a Session to the current JTA transaction, which is the right mechanism for an EJB container." now makes sense to me.

Thank you for the help.


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