java ee - Stateful sessions Beans CMT -


good afternoon in timezone.

i preparing ejb 3.0 certification exam , reading "ejb3 in action" book. in pros , cons of using bmt transaction type section , says "if using stateful session bean , need maintain transaction across method calls,bmt our option". can not understand sentence. imagine have following psedo class

 @stateful     @transactionmanagement(transactionmanagementtype.container)     @transactionattribute(transactionattributetype.required)     public class testbean implements test{         public void method1(...){...}         public void method2(...){...}         public void method2(...){            method1();            method2();      } }   

because defined @ class level methods have required transactionattribute value, when method3 calls method1 , method2 , methods join transaction created when calling method3, correct ? can clarify me in doubt ? in advance best regards

"maintain transaction across method calls" - referring different method calls client bean, not across calls in bean.

by default, in session bean, each method call creates separate transaction, must end end of method (unless called in provided transaction).

in stateful session bean can start transaction in 1 method, client can call few methods (still participating in same transaction) , call method either commit or rollback transaction (like checkout or cancel). able manually manage transaction need bmt.

i hope bit more clear now.


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -