Uploaded image for project: 'Application Server 3  4  5 and 6'
  1. Application Server 3 4 5 and 6
  2. JBAS-7218

ENC EM injection erroneously happens only once for web modules

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Do
    • Icon: Major Major
    • None
    • JBossAS-5.1.0.GA
    • None
    • None

      Using a persistence-context-ref element in the web.xml of a web module, it appears that this causes an EntityManager instance to be injected only once into the ENC of this component.

      However, the EJB 3.0 spec states in section 16.2.1:

      "In general, lookups of objects in the JNDI java: namespace are required to return a new instance of the requested object every time."

      So the observed behavior seems to violate the spec. In addition, this is particularly troublesome since an EntityManager is explicitly not thread-safe. Using the same EM instance for simultaneous requests therefor doesn't work.

      Of course there are several other methods to obtain an EM reference, for instance binding an EM factory directly to JNDI and using that to obtain the reference.

              Unassigned Unassigned
              henk53_jira henk de boer (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: