I have been looking into the cheat sheets available through JavaRanch and i have a question about them:
They seem to indicate that in BMT Stateless Session beans or Message Driven Beans, Transaction details (via getUserTransaction) are available through ejbCreate() and ejbRemove()
I think that this is wrong, can anyone confirm or deny this?
The reason why i think this is wrong is that bean creation and removal is not dependant on any of the user's action and therefore, does not make sense to be able to delimitate a transaction when you do not even know when it happens.
According to the spec. pg 90 Table 3, It clearly states that BMT stateless session beans can call EJBContext.getUserTransaction() in ejbCreate() and ejbRemove() methods, but UserTransaction methods (begin(), commit() etc...)can be called only in the business method from component interface.
Same logic for Message Driven Beans (spec pg. 320 Table 12).
Whereas in case of stateful session beans you can call EJBContext.getUserTransaction() and also methods on UserTransaction in ejbCreate()/ejbRemove()/ejbActivate()/ejbPassivate()/Business Methods
Hope this helps.
[ November 29, 2004: Message edited by: M Murthy ] [ November 29, 2004: Message edited by: M Murthy ]
Sindhu Murthy<br />SCJP 1.4<br />SCBCD
Joined: Apr 16, 2004
i understand it now. that's a very shuttle difference isn't it? that can really confuse you.
subject: question about ejbCreate() and ejbRemove() in Stateless SB or MDB