-->
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.  [ 1 post ] 
Author Message
 Post subject: Txn Rollback not working Properly with JTA or CMT
PostPosted: Wed Aug 21, 2013 5:30 am 
Newbie

Joined: Wed Aug 21, 2013 5:14 am
Posts: 1
I am using hibernate 3.0, with EJB 3.0 and JPA 1.0 in JBOSS 6 and Database Postgres 8.4.8.

I have used JTATransactionFactory for managing the transaction automatically.

Session is used by SessionFactory.getCurrentSession() method.

Autocommit is 'true' in hibernate.cfg.xml.

I am using the following code for rollbacking the txn.

@SessionContext ctx;

some business method {
///done some task

//update the database by ''Factory.getCurrentSession().persist(..);"



ctx.setRollBackOnly(); //working correctly

}

If i rollback here, this does the way it should do.

But if i again fetch the data of the same entityBean again by using namedQuery, it flushes the data, and I think also auto committing the data to DB, which is not allowing it to be rollbacked.

Code will look like this,

some business method {
///done some task

//update the database by ''Factory.getCurrentSession().persist(x);"

List<x> list = SessionFactory.getCurrentSession().getNameQuery(..).list();

ctx.setRollBackOnly(); //not workking here

}


Please reply me as i was not facing the problem when i was using EntityManager to fetch the Data from persistenceContext.
Is this is the problem in this hibernate version, or any other setting that i am missing.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.