Affects Version/s: V3
Fix Version/s: v3.0.1
Operating System: All
@PersistenceUnit and @PersistenceContext annotations are not being honored in
CDI managed beans in an EJB module if there isn't at least one EJB that also
uses the annotations.
I am attaching an EAR containing a single EJB module. The EJB module contains
one EJB, one Dao interface, and one DaoImpl class. The @PersistenceContext in
the DaoImpl class is ignored, given the EAR contents as they are. If you
add "@PersistenceContext EntityManager em;" at the top of the EJB, then both
annotations are honored (in the EJB and in the DaoImpl).
The expected result is that the @PersistenceContext in the DaoImpl should be
honored regardless of whether there's also an EJB with @PersistenceContext.
Sahoo told me the cause of this bug here:
"The persistence deployer in GlassFish is thinking that there is no component
in the EAR using the persistence-unit, so it does not initialize it. Obviously
that's a bug. It is not parsing managed beans."