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

jaikiran do-not-reply at jboss.com
Fri Jun 13 10:51:58 EDT 2008


"lpmon" wrote : Thanks for the input. I have never heard that you must use the proxy in this scenario.  I have seen this statement (from JBoss trailbalzer):
  | 
  | "In EJB 3.0 applications, transaction properties are most frequently declared for methods in session beans. If a method requires transaction, all operations in the method, including database updates, are only committed after the method exits normally."
  | 
  | If it is true that a proxy based call is required then it would be very important to include that in or near the above paragraph. Where is this documented? I would like to read up on this.  
  | 

If you are calling a method from within the bean (without using the proxy or what's called the EJBObject in EJB2.x terms) then it will be just another java method invocation. No new transactions will be started even if the transaction attribute on the method being called is REQUIRES_NEW. You might find this explained in a J2EE book.   

"lpmon" wrote : 
  | I made a change to use the proxy call and I still get the same exact result!
  | 
  | 
  |   The fact that the same em is used between calls is probably the root cause.

I see what you are saying. I always thought that when a new transaction is started, a *new instance* of the container managed entitymanager will be injected. I will have to read the specs to understand what's the expected behaviour.


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

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



More information about the jboss-user mailing list