• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Transaction can be rollback after InvocationContext.proceed?

 
Himai Minh
Ranch Hand
Posts: 1359
7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
On Frits' notes, p.41

AroundInvoke() methods may cause this rollback before or after InvocationContext.proceed() is called.


I found some examples and Invocation.proceed() is usually invoked when the interceptor method returns.

Example:


How can a transaction be rollback after ic.proceed()?
I think in this case, if we want to rollback a transaction after ic.proceed(), we should rollback the transaction in the next interceptor or the business method itself?
 
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper
Pie
Posts: 2531
112
Android Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
AroundInvoke methods are there to do something before the actual method or after the actual (or both before and after). In other words it is not uncommon to have business logic after the ic.proceed() method.

You can rollback the transaction by (EJB 3.1 specs):
12.3.1 Exceptions
Business method interceptor
AroundInvoke methods can mark the transaction for rollback by throwing a runtime exception or by calling the EJBContext setRollbackOnly() method. AroundInvoke methods may cause this rollback before or after InvocationContext.proceed() is called.


The InvocationContext API shows this example:
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic