Uploaded image for project: 'Cayenne'
  1. Cayenne
  2. CAY-2735

Missing events in CommitLogListener in "excludeFromTransaction" mode

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 4.2.B1
    • 5.0-M2
    • None
    • None

    Description

      I have a Persistent object X with the following @PostPersist

      @PostPersist
      public void postPersist() {
          setPropX(...calculation_based_on_id_);
          getObjectContext().commitChanges();
      }
      

      ... and a CommitLogListener in "excludeFromTransaction" mode, that needs to see both the new object creation and "propX" change in the same "onPostCommit" call:

      CommitLogModule.extend()
          .addListener(listener)
          .excludeFromTransaction()
          .module());
      

      When I create and commit a new X, it results in two commits in a single transaction (one from the user code, and another one - from PostPersist), with one INSERT and one UPDATE events respectively. But my "listener" only receives the update and 2 unexpected ObjectId change events (with "null" type).

      Removing "excludeFromTransaction", results in the listener correctly receiving first an INSERT and then an UPDATE events. But since those come as separate "onPostCommit" calls, it is hard to match them and make sense of the overall change.

      While I can probably find a workaround for my case, we need to think how the CommitLogFilter should behave when multiple operations occur in a single transaction. Need a better change merge algorithm to present a transparent "delta" across a bunch of operation.

      Attachments

        Activity

          People

            Unassigned Unassigned
            andrus Andrus Adamchik
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: