A question about declarative transaction management.
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   ramesh_malvey
Posted On:   Monday, October 22, 2001 05:22 PM

Hi, I have a basic question about the declarative transaction management. I have a table called Account in the database which contains account number and amount.I have created an entity bean,called an account entity bean for this table.Next,I would like to have a Stateful session bean which contains two methods,one for deposit and the other for withdrawal.I want to use a JSP as a client for EJB.This JSP will obtain a remote reference for the stateful session bean.Then,it will invoke the deposit method of the stateful session bean.This deposit method,will in turn obtain the remote reference of the account entity bean and sets the amount.Next, I will call the withdraw method of the stateful session bean and try to withdraw beyond the amount    More>>

Hi,


I have a basic question about the declarative transaction management.
I have a table called Account in the database which contains account number and amount.I have created an entity bean,called an account entity bean for this table.Next,I would like to have a Stateful session bean which contains two methods,one for deposit and the other for withdrawal.I want to use a JSP as a client for EJB.This JSP will obtain a remote reference for the stateful session bean.Then,it will invoke the deposit method of the stateful session bean.This deposit method,will in turn obtain the remote reference of the account entity bean and sets the amount.Next, I will call the withdraw method of the stateful session bean and try to withdraw beyond the amount limit.In this case,the method throws a runtime exception.Supposing that I have given the TX_REQUIRED attribute for both the methods of the stateful session bean,will it rollback the transaction automatically and restores the amount value in the database to its previous state i.e. the value it had before a call to the deposit method ?
What if this runtime exception is explicitly caught? will the transaction still be rolled back ?



Suppose,I have a method in Stateful session bean(first ssb) which in turn calls two other methods of another stateful session bean(second ssb) out of which one throws a runtime exception and the method of the first stateful session bean explicitly catches this exception and does the processing. In this case whether the transaction will still be rolled back assuming that all the methods have a TX_Required attribute.




Please help me in understanding the declarative transaction management.

   <<Less
About | Sitemap | Contact