« SDK 2.1.4 beta from SonyEricsson avaiable | Main | J2ME Toolkit 2.2 released »

setSessionContext() and the Transaction Context

While testing a ported J2EE application with OC4J, I encountered a problem with the combination of the RequiresNew and Mandatory transaction attributes.

Deeper investigation showed that the application has a call chain setSessionContext() - init() - SessionBeanFacade.create() - EntityBean transactional method.

With a little help of the OC4J Development folks, we found that reading the EJB specification is valuable. It clearly states that setSessionContext() is not in a transaction state and it's up to the container vendor how this is implemented.

The specification clearly states that the bean developer should not rely on a containers behaviour and program conservatively.

In essence: Never call a transactional bean method from within setSessionContext().

References:
- EJB 2.0, chapters 7.5.7, 7.6.1, 7.8.2, 17.6.5
- EJB 2.1, chapters 7.5.9, 7.6.1, 7.8.2, 17.6.5

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)

About This Entry

This page contains a single entry from the blog posted on October 19, 2004 4:08 PM.

The previous post in this blog was SDK 2.1.4 beta from SonyEricsson avaiable.

The next post in this blog is J2ME Toolkit 2.2 released.

Many more can be found on the main index page or by looking through the archives.

Top Tags

Powered by
Movable Type and Oracle