You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by "Nikita Timofeev (Jira)" <ji...@apache.org> on 2022/10/13 14:58:00 UTC

[jira] [Updated] (CAY-2735) Missing events in CommitLogListener in "excludeFromTransaction" mode

     [ https://issues.apache.org/jira/browse/CAY-2735?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Nikita Timofeev updated CAY-2735:
---------------------------------
    Fix Version/s: 4.3.M1

> Missing events in CommitLogListener in "excludeFromTransaction" mode
> --------------------------------------------------------------------
>
>                 Key: CAY-2735
>                 URL: https://issues.apache.org/jira/browse/CAY-2735
>             Project: Cayenne
>          Issue Type: Bug
>    Affects Versions: 4.2.B1
>            Reporter: Andrus Adamchik
>            Priority: Minor
>             Fix For: 4.3.M1
>
>
> I have a Persistent object X with the following {{@PostPersist}} 
> {noformat}
> @PostPersist
> public void postPersist() {
>     setPropX(...calculation_based_on_id_);
>     getObjectContext().commitChanges();
> }
> {noformat}
> ... and a CommitLogListener in "excludeFromTransaction" mode, that needs to see both the new object creation and "propX" change in the same "onPostCommit" call:
> {noformat}
> CommitLogModule.extend()
>     .addListener(listener)
>     .excludeFromTransaction()
>     .module());
> {noformat}
> 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. 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)