-->
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: How can I test a JTA UserTransaction Rollback?
PostPosted: Wed Aug 16, 2006 12:58 am 
Newbie

Joined: Thu Aug 03, 2006 6:54 pm
Posts: 16
Hello Hibernate Users,

I have code something similar to this:

Code:
// BMT idiom with getCurrentSession()
try {
   UserTransaction tx = (UserTransaction)new InitialContext()
            .lookup("java:comp/UserTransaction");
   tx.begin();
   
   // Do some work on Session bound to transaction
   factory.getCurrentSession().load(...);
   factory.getCurrentSession().persist(...);
   tx.commit();
}
catch (RuntimeException e) {
   tx.rollback();
   throw e; // or display error message
}


Basically all I want to do is test that it is working properly. I dont need to write a Junit test, just a manual method of testing this will be fine.

If anyone could provide help on the matter it would be much appreciated.

Outlaw


Top
 Profile  
 
 Post subject: make a foreign key fail
PostPosted: Wed Aug 16, 2006 7:18 pm 
Beginner
Beginner

Joined: Thu Dec 09, 2004 7:04 pm
Posts: 26
Location: Denver, CO
One way to manually test it is to have an update that fails because of a foreign key association failed.


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.