[jboss-user] [EJB 3.0] - Re: Transactions Question: Subsequent calls the method fail

jaikiran do-not-reply at jboss.com
Thu Jun 12 11:30:25 EDT 2008


"lpmon" wrote : 
  | I call it from another method in the same SLSB in a loop.  
  | 
  | I thought the REQUIRES_NEW transaction annotation would start over with a clean slate so to speak.
  | 
  | 
  | 

If you are calling the method as a plain java method invocation in that loop, then the TransactionAttribute will have no affect. You will have to call the method on the EJB proxy for the transaction attributes to take affect. Something like this:

  | public void outerMethod(...) {	
  | 	
  | 	for (int i=0;i<10; i++) {
  | 
  | 		//get the proxy
  | 		MyBeanInterface bean = (MyBeanInterface) this.sessionContext.getBusinessObject(UserManager.class);
  | 
  | 		// call the inner method on the proxy
  | 		bean.runStatement("some sql");
  | 	}
  | 
  | }

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

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



More information about the jboss-user mailing list