posted 20 years ago
Hi Mark,
[I have edited my answer regarding stateful session beans]
The transaction context in ejbCreate and ejbRemove depends on the type of bean you are looking at. For entity beans, the containers call to the ejbCreate and ejbRemove methods is related to the client call and can therefore participate in the caller�s transaction and therefore access resource managers other enterprise beans etc. For stateless session beans and message driven beans the containers call to the ejbCreate and ejbRemove methods is not related to a client call and can therefore not participate in the caller�s transaction, in other words the transaction context is unspecified, i.e. you cannot write code that depends on a transaction being present.
For stateful session beans the transaction is also unspecified in ejbCreate and ejbRemove but the explanation given above does not apply here because the containers call to ejbCreate and ejbRemove is related to the client call. The spec gives the following reason (page 76)
-----
�. The ejbCreate and ejbRemove methods are not controlled by a transaction attribute because handling
rollbacks in these methods would greatly complicate the session instance�s state diagram. �.
-----
So for statefull session beans you can access resource managers and enterprise beans in ejbCreate and ejbRemove in a way that do not depend on a transaction being present.
Kind regards
Christian
[ July 09, 2004: Message edited by: Christian Sellberg ]