Last active
May 31, 2017 10:20
-
-
Save andrus/2c9e7daf305d934b0b007e13ecb2decd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CommitLogListener listener = // custom listener | |
Module commitLog = CommitLogModule | |
.extend() | |
.addListener(listener) | |
.commitLogAnnotationEntitiesOnly() | |
.module(); | |
ServerRuntime runtime = ServerRuntime | |
.builder() | |
.addConfig("cayenne-project.xml") | |
.addModule(postCommit) | |
.build(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Here is how you track all commit changes in Cayenne. This includes direct ObjectContext changes or changes originating from pre- listeners/callbacks. Requires Cayenne 4.0.B1 or newer. You will need to add
org.apache.cayenne:cayenne-commitlog
dependency that will auto-load a corresponding module, and then add customCommitLogListener
objects to receive the events.If you have callbacks or listeners modifying the context being committed in pre- events, make sure that
CommitLogFilter
is included in transaction. This is true by default, unless you explicitly callCommitLogModule.extend().excludeFromTransaction()
.