OpenJPA
  1. OpenJPA
  2. OPENJPA-506

PreRemove method callback is never called; PreUpdate is always called

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.1.0
    • Fix Version/s: 1.0.2, 1.1.0
    • Component/s: None
    • Labels:
      None
    • Environment:
      Windows XP, JDK1.5, JDK6, PostgreSQL

      Description

      I am using EntityListeners to catch Insert, Update and Delete events. During my test case I notice that PreRemove method callback is never called. In the same time PreUpdate is always called whether Delete (em.remove()) or Insert is called.

      In my opinion Pre/Post Persist must be called on Insert operations. Pre/Post Update must be called on Update operations. Pre/Post Remove must be called on Delete operations.

        Issue Links

          Activity

          Hide
          Patrick Linskey added a comment -

          Sure enough, things look a bit messed up (at least in 1.0.x). I've beefed up our existing test case, and have partially resolved the problem.

          I believe that we should call Pre/PostUpdate for records that are persisted, flushed, and then modified. I do not believe that we should call Pre/PostUpdate for records that have been flushed, not modified, and then flushed again.

          Show
          Patrick Linskey added a comment - Sure enough, things look a bit messed up (at least in 1.0.x). I've beefed up our existing test case, and have partially resolved the problem. I believe that we should call Pre/PostUpdate for records that are persisted, flushed, and then modified. I do not believe that we should call Pre/PostUpdate for records that have been flushed, not modified, and then flushed again.
          Hide
          Patrick Linskey added a comment -

          Resolved in 1.0.x; keeping open pending 1.1.0 resolution.

          Show
          Patrick Linskey added a comment - Resolved in 1.0.x; keeping open pending 1.1.0 resolution.
          Hide
          Patrick Linskey added a comment -

          OpenJPA is now in line with the JPA spec's defined behavior. Additionally, new instances that are persisted and then flushed and then modified, and existing instances that are modified, flushed, and then modified again will receive Pre/PostUpdate callbacks for the subsequent modifications.

          Show
          Patrick Linskey added a comment - OpenJPA is now in line with the JPA spec's defined behavior. Additionally, new instances that are persisted and then flushed and then modified, and existing instances that are modified, flushed, and then modified again will receive Pre/PostUpdate callbacks for the subsequent modifications.

            People

            • Assignee:
              Unassigned
              Reporter:
              Miroslav Nachev
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development