Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Hibernate and JTA

Reply
Thread Tools

Hibernate and JTA

 
 
TH Lim
Guest
Posts: n/a
 
      07-10-2003
Hi,

I am using JTA as my transaction demarcation in my servlet under Orion
AppServer. MySQL is the database Orion is connected to. My code that
forces a rollback looks like this,

<code>
utx.begin(); // UserTransaction.begin()
// session is an instance of net.sf.hibernate.Session
q = session.createQuery("from Account as acc order by
acc.name");
clients = q.list();
for (Iterator clientIter = clients.iterator();
clientIter.hasNext() {
Account acc = (Account) clientIter.next();
acc.setBalance(acc.getBalance() - 500);
session.update(acc);
}

utx.setRollbackOnly();
clients = q.list();
for (Iterator clientIter = clients.iterator();
clientIter.hasNext() {
Account acc = (Account) clientIter.next();
log(acc.getName() + " with balance " +
acc.getBalance());
}

</code>

I updated Account's balance to a new value and forced a rollback. So
when I reread the balance, it should give me the previous value.
Right? What have I done wrong here? It works with Hibernate own's
transaction mechanism. Pls. advise.Thank you.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Right use for JTA transactions? Scott Balmos Java 6 03-16-2010 09:10 PM
JTA support for non XA drivers/connections kalpesh.mahadik@gmail.com Java 1 03-03-2007 04:06 AM
jaas.jar, jta.jar jdbc-stdext.jar missing from jdk1.5 RPM muttley Java 0 10-20-2005 02:40 PM
Distributed transactions using JTA and JTS Distrans Java 0 01-13-2005 06:19 PM
standalone JTA transaction manager MetroFix Java 1 09-08-2003 09:22 AM



Advertisments