Details

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

      Description

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

        Activity

        Hide
        Cody Lerum
        added a comment -

        Looks great. Thanks!

        Show
        Cody Lerum
        added a comment - Looks great. Thanks!
        Hide
        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
        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
        Pete Muir
        added a comment -

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

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

        This is fixed in JPA

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

          People

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

            Dates

            • Created:
              Updated:
              Resolved: