[
https://issues.apache.org/jira/browse/OPENEJB-1086?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
David Blevins updated OPENEJB-1086:
-----------------------------------
Description:
Latest EJB 3.1 spec allows @TransactionAttribute on the
PostConstruct/PreDestroy callbacks of @Singleton beans. Use of
@TransactionAttribute on the PostConstruct/PreDestroy callbacks of any other
bean type is still illegal.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
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).
was:
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).
Affects Version/s: 3.1
3.1.1
Fix Version/s: 3.1.x
Issue Type: Improvement (was: Bug)
Summary: @TransactionAttribute support for @Singleton
PostConstruct/PreDestroy callbacks (was: Transaction policies not applied for
lifecycle callback interceptor methods for @Singleton)
> @TransactionAttribute support for @Singleton PostConstruct/PreDestroy
> callbacks
> -------------------------------------------------------------------------------
>
> Key: OPENEJB-1086
> URL: https://issues.apache.org/jira/browse/OPENEJB-1086
> Project: OpenEJB
> Issue Type: Improvement
> Affects Versions: 3.1, 3.1.1, 3.1.2
> Reporter: Jean-Louis MONTEIRO
> Fix For: 3.1.x
>
>
> Latest EJB 3.1 spec allows @TransactionAttribute on the
> PostConstruct/PreDestroy callbacks of @Singleton beans. Use of
> @TransactionAttribute on the PostConstruct/PreDestroy callbacks of any other
> bean type is still illegal.
> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
> - -
> 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.