For BMT, ejbCreate/ejbRemove have access to getUseTransaction. Does this mean it can execute methods within the UserTransaction interface. If so, why does it list UserTransaction methods for ejbCreate/ejbRemove - similiar to onMessage(). That is, onMessage states getUserTransaction() and UserTransaction methods. [ November 09, 2004: Message edited by: Billy Hickory ]
My understanding: ejbRemove/ejbCreate in MDB is not triggered by client (no client in MDB). It's up to the container to determine when to use these callbacks. Therefore there is no meaningful transaction context during ejbCreate/ejbRemove, hense you cannot call getUserTransaction.
True..the client can not call these methods - actually the container calls these methods. However, the provider can put code in these methods. On page 320 of the spec, it does state you can call getUserTransaction() method in ejbCreate and ejbRemove. If so, you have the Usertransaction object, which means you should be able to call the UserTransaction methods.
I believe it is an error in the specs. That is, if you have access to getUserTransaction(), you should be able to call the UserTransaction methods.
UserTransaction for MDB has nothing to do with the user who sent message. UserTransaction is a reference to Transaction Manager. On ejbCreate() bean stores a reference to Transaction Manager and then later multiple times uses it to begin and commit transaction in onMessage() method. It is more efficient then obtaining UserTransaction every time when container invokes bean onMessage() method.
Nothing up my sleeve ... and ... presto! A tiny ad:
Devious Experiments for a Truly Passive Greenhouse!