Transaction policies not applied for lifecycle callback interceptor methods for
@Singleton
------------------------------------------------------------------------------------------
Key: OPENEJB-1086
URL: https://issues.apache.org/jira/browse/OPENEJB-1086
Project: OpenEJB
Issue Type: Bug
Affects Versions: 3.1.2
Reporter: Jean-Louis MONTEIRO
OpenEJB does not seem to apply transaction policies with @Singleton beans.
My feeling (after checking in the spec) is that we must deal with transaction
policies for PostConstruct/PreDestroy lifecycle callback interceptor methods.
Actually, it's not the case for @Singleton nor @Stateless whereas we do it for
@Stateful.
4.3.14 Transaction Context of Session Bean Methods
{quote}
The implementation of a method defined in a session bean's business interface
or component interface or no-interface view, a web service method, timeout
callback method, or singleton PostConstruct/PreDestroy lifecycle callback
interceptor method, is invoked in the scope of a transaction determined by the
transaction attribute specified in the bean's metadata annotations or
deployment descriptor.
...
For example, it would be wrong to perform database operations within a stateful
session bean's PostConstruct or PreDestroy lifecycle callback interceptor
methods and to assume that the operations are part of the client's transaction.
The PostConstruct and PreDestroy methods for stateful and stateless session
beans are not controlled by a transaction attribute because handling rollbacks
in these methods would greatly complicate the session instance's state diagram.
{quote}
4.3.4 Session Bean Lifecycle Callback Interceptor Methods
{quote}
The PostConstruct lifecycle callback interceptor methods for stateless and
stateful session execute in an unspecified transaction context.
{quote}
13.6 is also a good pointer.
So, from my understanding, we should manage transaction policies in lifecycle
methods for @Singleton but not necessary for @MDB @Stateless and Stateful (an
unspecified transaction context).
IMHO, we should add some consistency because the behavior for @Stateless and
@Stateful is different (BTW, i didn't check for MDB).
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.