]
Yeray Borges reassigned WFLY-9845:
----------------------------------
Assignee: Yeray Borges
@Singleton @Startup classes inheriting from a class containing a
@PostConstruct method will not create a transaction
--------------------------------------------------------------------------------------------------------------------
Key: WFLY-9845
URL:
https://issues.jboss.org/browse/WFLY-9845
Project: WildFly
Issue Type: Bug
Components: EJB
Affects Versions: 9.0.0.Final, 11.0.0.Final
Reporter: Christopher Czyba
Assignee: Yeray Borges
Attachments: singleton-postconstruct-transaction.zip, standalone.log
During an update from wildfly 8.2.0.Final to 11.0.0.Final I have noticed the following
issue:
Given an abstract base class B with an @PostConstruct annotated method and a derived
class D with the annotations @Singleton and @Startup. When the @PostConstruct method is
called, no transaction is started.
According to the [EJB 3.2
Specification|http://download.oracle.com/otn-pub/jcp/ejb-3_2-fr-eval-spec...]
section 4.8.3, I would expect the container to start a new transaction, as the default
transaction attribute is REQUIRED.
I have attached source for a war showcasing this issue. On deploying the resulting war on
a new wildfly instance, the log should contain the following two lines:
{{14:13:06,410 INFO [stdout] (ServerService Thread Pool -- 20) Singleton Hierarchy:
transaction status: 6
14:13:06,410 INFO [stdout] (ServerService Thread Pool -- 58) Singleton2 Standalone:
transaction status: 0}}
A transaction status of 6 says that no transaction exists, while a transaction status of
0 implies that a transaction is ongoing. The war shows that this issue occurs only when
using a class hierarchy. I expect the status 0 for both cases.
Through testing I noticed that this issue exists since wildfly 9.0.0.Final. I could not
find a reason for this behavior from the list of issues for the 9-series release, however.