-->
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: wich exceptions are thrown inside @Transactional
PostPosted: Mon Mar 15, 2010 8:38 am 
Newbie

Joined: Wed Feb 10, 2010 12:18 pm
Posts: 2
Hello!

I'd like to know which type of exceptions are thrown inside methods which are @Transactional - that means which one I may catch inside the procedure and which one are forwareded to the caller. In other words, which type of exceptions may occour when the commit operation is performed.

Currently I catch all DataAccessException, HibernateException and TransactionException via an AOP proxy. But now, I need to handle occuring exceptions inside @Transactional annotated methods. If for example one of many persists inside the method fails, the legacy business logic must not be performed.
I'm not sure when some of these exceptions are thrown - for example when an invalid persist is performed.

Let me give you a simple example what I want to do:
Code:
@Transactional
void transactionalMethod() {
  try {
    persist(Entity);
    doSomething(); //this method should be only invoked when the prevoius persist succeeds
  }
  catch(xxxException e) { //which exceptions can be catched here and are not dependent on the transaction mechanism
    doSomethingDifferent();
  }
}

void main() {
  try {
    transactionalMethod();
  }
  catch(xxxException e) {
    //which exceptions come here and cannot be catched inside "transactionalMethod"
  }
}


I think a TransactionException is thrown and catched outside the "transactionalMethod" but I'm not sure about the other exceptions.

I would really appreciate some help for this issue.

Thanks!

-meisterlampe


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.