-->
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.  [ 2 posts ] 
Author Message
 Post subject: "Transaction instance is no longer valid"
PostPosted: Thu May 28, 2015 9:21 am 
Newbie

Joined: Tue May 19, 2015 7:52 am
Posts: 5
Hi All,

I'm running an EJB application in WildFly in which I use Hibernate. All have been working just fine, but now I stumbled to a problem, when I wan't to have two transactions in one method call (ie. the second transaction is a long running one, and I want to commit the first transaction before the start of the long running process)

So, my code is like this:
Code:
public void myMethod(){
   try{
      Transaction tr = HibernateUtil.getSessionFactory().getCurrentSession().beginTransaction();
      //execute some DB operation
      tr.commit();
      
      tr = HibernateUtil.getSessionFactory().getCurrentSession().beginTransaction();
      //execute some DB operation
      tr.commit();
   
   }catch(Exception e){
      e.printStackTrace();
   }
}


The second call to beginTransaction() throws org.hibernate.TransactionException: Transaction instance is no longer valid. What is actually causing this and how can I go around it?

I have set current_session_context_class to JTA and transaction.factory_class to org.hibernate.transaction.JTATransactionFactory in hibernate.cfg.xml


Top
 Profile  
 
 Post subject: Re: "Transaction instance is no longer valid"
PostPosted: Thu Jul 02, 2015 8:55 am 
Newbie

Joined: Thu Jul 02, 2015 8:53 am
Posts: 1
Hi Icosidodecahedron,

I have exactly same problem after upgrading to Jboss 6.4 EAP. Did you found any solution to the problem?

Thanks,
marluc


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