Hello,
What is the importance of Transaction in Stateful session bean.
I am using a Shopping Cart Application with following Transcation attribute -
TX_NOT_SUPPORTED
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
-
Transaction in Stateful Session Bean (2 messages)
- Posted by: Server Side
- Posted on: October 20 2003 15:20 EDT
Threaded Messages (2)
- RE: Transaction in Stateful Session Bean by Ajaykumar Menon on October 21 2003 05:08 EDT
- Trans and SFSB by Billy Newport on November 08 2003 22:54 EST
-
RE: Transaction in Stateful Session Bean[ Go to top ]
- Posted by: Ajaykumar Menon
- Posted on: October 21 2003 05:08 EDT
- in response to Server Side
Hi Buddy,
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.
Regards,
Ajaykumar. -
Trans and SFSB[ Go to top ]
- Posted by: Billy Newport
- Posted on: November 08 2003 22:54 EST
- in response to Server Side
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...
Billy