-->
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: Transaction rollback
PostPosted: Sat Nov 13, 2004 2:34 pm 
Beginner
Beginner

Joined: Mon Sep 08, 2003 10:56 am
Posts: 35
I want to make sure I am handleing transactions properly. I was hoping to find an SLSB example in caveat emptor (using the hibernate integration code, but I didn't see any).

Right now I'm basically doing this inside an SLSB method:
Code:
Transaction tx = null;
try {
          Session sess = HibernateContext.getSession(DBO_SESSION);
            sess.save(order);
        } catch (HibernateException e) {
            throw new DataStoreException(e.getMessage(), e);
        }


What I'd like to know is, how to I latch on to the containers transaction to do a rollback, given that you don't use sessiong.beginTransaction with CMT?

When a hibernate exception is thrown, I want to rollback the work I did. Will the container handle this automatically somehow? I'm basically just looking for an example of the proper way to roll back a unit of work with CMT & hibernate, when a hibernate exception is thrown.


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.