• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Transaction is not rolled back under BMT when application exception happens

 
Himai Minh
Ranch Hand
Posts: 1361
7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
On p .387 and p.393, I noticed these:
1. Under BMT, when a singleton/stateless/stateful bean throws an application exception , the transaction is not rollback by the container. And the application exception is thrown to the client.
2. Under BMT, when a message driven bean throws an application exception, the transaction is not rollback neither. The exception is re thrown to resource adaptor.

Why the transaction is not rollback when application exception occurs under BMT?
Or, the bean provider (developer) has to handle this by calling UserTransaction.rollback() in the business method when the application exception is caught ?
 
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper
Pie
Posts: 2536
113
Android Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
An application exception thrown by an enterprise bean should not automatically rollback a client’s transaction. (no matter whether the bean is BM or CM)

The reason why is:
  • An application exception is an exception defined by the Bean Provider as part of the business logic of an application.
  • A client can typically recover from an application exception

  •  
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic