-->
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: how create a new session in ejb that using jta?
PostPosted: Thu Nov 03, 2005 4:35 pm 
Beginner
Beginner

Joined: Tue Jul 12, 2005 1:50 pm
Posts: 26
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
I use jta.
I get session: session = getSessionFactory().getCurrentSession();
Hibernate version: 3.0

How can I create a new session in my ejb ?
I dont want to go to the view and cause a new session to be created.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 04, 2005 8:35 am 
Expert
Expert

Joined: Sat Oct 25, 2003 8:49 am
Posts: 490
Location: Vrhnika, Slovenia
Have you looked at this?
- http://forum.hibernate.org/viewtopic.php?t=939039


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 04, 2005 8:40 am 
Expert
Expert

Joined: Sat Oct 25, 2003 8:49 am
Posts: 490
Location: Vrhnika, Slovenia
Ups. Wrong previous post.

What's wrong with SessionFactory.openSession()?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 04, 2005 11:28 am 
Beginner
Beginner

Joined: Tue Jul 12, 2005 1:50 pm
Posts: 26
jta assigns a hibernate session to the whole request that was sent from view.
In the middle of transaction, I could close the session but I could not open a new session.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 04, 2005 3:33 pm 
Expert
Expert

Joined: Sat Oct 25, 2003 8:49 am
Posts: 490
Location: Vrhnika, Slovenia
What do you mean you cannot open new session?
Who provides a transaction for your request?

Otherwise SF.getCurrentSession() doesn't work, if there is no underlaying transaction.

There is no problem for you to open a new session - SF.openSession(). It will still be a part of previous transaction.
You can even open a new transaction, suspending the current and later on resume with it.


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.