Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Unspecified, but meaningful transaction?

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
LS,

The following confused me while reading the EJB 2.0 specs. In 7.5.7 it states that a session bean's ejbCreate and ejbRemove are called within an unspecificied transaction. In 7.6.1 I read that accessing resource managers and enterprise beans is dissallowed in the session bean's methods for which the Container does not have a meaningful transaction context. But the table on page 80 allows accessing resource managers and enterprise beans in the ejbCreate and ejbRemove methods. Does this mean that an unspecified transaction is a meaningful transaction?

thanks,
Mark
 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Mark Hoogenboom
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Christian. Your explanation makes a lot more sense than the remarks in 7.5.7 and 17.6.5 about the transaction context of a session bean's ejbCreate en ejbRemove methods.

kind regards,
Mark
 
Don't listen to Steve. Just read this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic