Details

    • Type: Tracker
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: 1.0
    • Fix Version/s: 1.1.PFD
    • Component/s: None
    • Labels:
      None

      Description

      It would be very convenient if CDI was available inside JPA Entity Listeners.

        Gliffy Diagrams

          Activity

          Hide
          clerum Cody Lerum added a comment -

          Looks great. Thanks!

          Show
          clerum Cody Lerum added a comment - Looks great. Thanks!
          Hide
          french_c Jens Schumann added a comment - - edited

          Since I have been running into this issue lately: JPA does not recommend EntityManager interactions within JPA lifecycle callbacks*. Shouldn't we add a note somewhere that injected resources require special attention regarding JPA compliance? And because of that firing CDI events from a JPA entity listener is particularly dangerous?

          In my case I tried to implement global available created/updated/deleted entity events which turned out to be an bad idea if implemented on EntityListener level.


          * JPA Spec 3.5.2: In general, the lifecycle method of a portable application should not invoke EntityManager or Query operations, access other entity instances, or modify relationships within the same persistence context.[45] A lifecycle callback method may modify the non-relationship state of the entity on which it is invoked.

          Show
          french_c Jens Schumann added a comment - - edited Since I have been running into this issue lately: JPA does not recommend EntityManager interactions within JPA lifecycle callbacks*. Shouldn't we add a note somewhere that injected resources require special attention regarding JPA compliance? And because of that firing CDI events from a JPA entity listener is particularly dangerous? In my case I tried to implement global available created/updated/deleted entity events which turned out to be an bad idea if implemented on EntityListener level. * JPA Spec 3.5.2: In general, the lifecycle method of a portable application should not invoke EntityManager or Query operations, access other entity instances, or modify relationships within the same persistence context. [45] A lifecycle callback method may modify the non-relationship state of the entity on which it is invoked.
          Hide
          pmuir Pete Muir added a comment -

          Jens, this comment needs to be sent to the JPA spec.

          Show
          pmuir Pete Muir added a comment - Jens, this comment needs to be sent to the JPA spec.
          Hide
          french_c Jens Schumann added a comment -
          Show
          french_c Jens Schumann added a comment - Done. http://java.net/jira/browse/JPA_SPEC-37
          Hide
          pmuir Pete Muir added a comment -

          This is fixed in JPA

          Show
          pmuir Pete Muir added a comment - This is fixed in JPA

            People

            • Assignee:
              pmuir Pete Muir
              Reporter:
              clerum Cody Lerum
            • Votes:
              2 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development