Forums Register Login

Transaction(open across multiple)

+Pie Number of slices to send: Send
Spec. say "BMT can be used to keey a transaction open across multiple invocation to a stateful method bean.".
but I can not understand purpose of this rule.Can somebody show me a
example?
+Pie Number of slices to send: Send
The 'purpose of the Rule' is to allow the Stateful Bean using BMT to execute multiple business methods in the same transaction.
Consider a scenario:
A stateful session Bean uses BMT. Client calls multiple methods, method_1() , method_2(), .. method_n() which are to be executed in the same transaction.
Flow:
1. Client invokes the bean's method_1().
2. method_1() has BMT demarcation to start a transaction T_1 using UserTransaction.begin().
3. method_1() returns without completing transaction T_1.
4. method_2() is called next, since T_1 is already associated with the instance the method executes in transaction T_1.
5. method_2() returns without completing the transaction.
6. method_n() is the last to be called, it continues in T_1, and eventually commits/rollbacks the transaction T_1 using UserTransaction.commit().
Conditions:
a. If method_2() ( or method_n() ) attempts to open a new transaction in the above scenario, when T_1 is already open and has not been commited, it will throw javax.transaction.NotSupportedException in the UserTransaction.begin() method.
b. Stateless Beans are however required to complete the transaction before the business method returns (unlike Stateful Session Beans).
Note: If the client calls the method_1() in his own transaction , the client's transaction is always suspended before BMT starts its own transactions.
I hope it answers your question.
Regards,
Shafique.
[ March 03, 2004: Message edited by: Shafique Razzaque ]
+Pie Number of slices to send: Send
got it. thank you very much.
Space seems cool in the movies, but once you get out there, it is super boring. Now for a fascinating tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 595 times.
Similar Threads
container managed transactions
Obtaining transction reference for stateless session beans
why stateless session bean cannot implement SessionSynchronisation?
CMT Transaction
Database connection management
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 06:37:54.