What is the importance of Transaction in Stateful session bean.
I am using a Shopping Cart Application with following Transcation attribute -
I am not setting any User Transcation from the code.
Do i need to set this, or the above will work.
I am not sure on the consequences of using TX_NOT_SUPPORTED
Thanks for any feedback
To understand a solution, you need to ask fundamentally this -> Is the entire work done by the Session Bean, meant to be atomic in nature.
Going through a standard example.
Take a bean that does transferAmount(X,Y).
Inturn it calls two methods debit(X) and credit(Y).
It is 'okay' (functionally) to allow the person to debit(X) yet not credit(Y)?
The answer to this would be NO.
In which case the transaction setting must be (atleast) SUPPORTS.
In your application ask a similar question, and you would know the answer.
All the best.
Trans are kind of magic when used with SFSB. This is because when using NOT_SUPPORTED, the tran is considered part of the state of the EJB. So, if a SFSB starts a tran in a NOT_SUPPORTED method then the container suspends the tran and returns. Normally, you'd have expected the container to rollback such a transaction.
The next time the SFSB is called then the tran is resumed until the SFSB explicitly commits or it times out.
Another reason why we sometimes wonder why we were invented SFSBs...