I have a method in java class which uses UserTransaction and within transaction it calls enitiy bean create() (It creates a row in database). Now just incase if i roll back this transaction then it does not rollback entity created in entity bean.
structure of the code is something like this....
Transaction attribute for entity bean is Required.
The transactional XML attributes only come into play if you are using Container Management Transactions (CMT). If you are creating/starting transactions on your own, or bean managed transaction (BMT), the behavior is completely up to you.
Originally posted by Scott Selikoff: The transactional XML attributes only come into play if you are using Container Management Transactions (CMT). If you are creating/starting transactions on your own, or bean managed transaction (BMT), the behavior is completely up to you.
Yes i get that. But my question is, I am calling a method which has CMT inside a method (in a separate class) which is under Usertransaction. Then it should join User transaction right ?
In summary i am trying to figureout "Will calling EnitiyBean create() method which is under CMT; will join User transaction if its called from that transaction ?"
ClassA { UT.begin ejbCreate(); UT.end }
//Under CMT EntityBeanClassB { ejbCreate(); } [ July 10, 2008: Message edited by: jigara shah ]
It should join the transaction, although depending on your ejb version and server it may throw an exception. Why don't you try and see for yourself? Best way to learn is to try it out.