glassfish
  1. glassfish
  2. GLASSFISH-11767

Persistence deployer ignores @PersistenceUnit / @PersistenceContext annotations in CDI managed beans

    Details

    • Issuezilla Id:
      11,767

      Description

      @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:

      http://forums.java.net/jive/message.jspa?messageID=395980#395980

      "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."

        Activity

        Hide
        theodan added a comment -

        Created an attachment (id=4297)
        EAR with EJB module and source code

        Show
        theodan added a comment - Created an attachment (id=4297) EAR with EJB module and source code
        Hide
        theodan added a comment -

        I'm asking for a v3.0.1 target.

        Show
        theodan added a comment - I'm asking for a v3.0.1 target.
        Hide
        theodan added a comment -

        Setting URL to forum discussion.

        Show
        theodan added a comment - Setting URL to forum discussion.
        Hide
        Hong Zhang added a comment -

        assign to mitesh for initial evaluation

        Show
        Hong Zhang added a comment - assign to mitesh for initial evaluation
        Show
        Mitesh Meswani added a comment - Fixed with http://fisheye4.atlassian.com/changelog/glassfish-svn/?cs=37568

          People

          • Assignee:
            Mitesh Meswani
            Reporter:
            theodan
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: