[jboss-user] [EJB 3.0] - Re: Transaction question, REQUIRES_NEW

atamur do-not-reply at jboss.com
Fri Oct 20 07:11:52 EDT 2006


"busawreck" wrote : I have a Stateless SB with a business method (m1) for completing a series of tasks all in their own transactions, so that if task xx fails the other tasks will still complete. For each task I call a business method (m2) on the same bean with the annotation TransactionAttribute(REQUIRES_NEW).
  |    I would expect that when I throw (and catch) a RuntimeException in m2, it would mark my current transaction for rollback, but the transaction in m1 would not be marked for rollback. When I run my program though, I notice that after the RuntimException has been thrown (and caught) in m2, the transaction in m1 is marked for rollback, hence all calls to m2 fails aswell. 
  |    Where am I doing/thinking wrong :).
please provide some code

if you haveclass sb implemets sb_remote{
  | @EJB
  | private sb_remote sb;
  | public void m1() {
  | }
  | 
  | public void m2() {
  | }
  | }
  | 
you should write in m1:
sb.m2() not this.m2!

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3979623#3979623

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3979623



More information about the jboss-user mailing list