Hi all, More progress I think I figured it out. I created a class that implements GraphChangeHandler.
Then, in the onSync() method I do this: var handler = new AuditGraphChangeHandler(); changes.apply(handler); Where changes is the GraphDiff passed into the onSync() method. The AuditGraphChangeHandler prints out what I was looking for. Thank you Ricardo Parada > On Oct 8, 2025, at 1:38 PM, Ricardo Parada <[email protected]> wrote: > > > Hi all, > > I made a little bit of progress. I’m doing this: > > var myAuditFilter = new AuditFilter(); > > // Register the filter manually > runtime.getDataDomain().addFilter(myAuditFilter); > > Then in AuditFilter implementation I have this method below only. The problem > is ObjDiff doesn’t seem to have any API to get the name of the property, > before and after values. > > @Override > public GraphDiff onSync( > ObjectContext originatingContext, > GraphDiff diff, > int syncType, > DataChannelSyncFilterChain filterChain) { > > if (diff instanceof ObjectStoreGraphDiff changes) { > // Let's peek > for (var entry : changes.getChangesByObjectId().entrySet()) { > Object objId = entry.getKey(); > ObjectDiff objDiff = entry.getValue(); > System.out.println("objId = " + objId); > System.out.println("objDiff = " + objDiff); > } > } > > return filterChain.onSync(originatingContext, diff, syncType); > } > > > >> >> On Oct 8, 2025, at 10:57 AM, Ricardo Parada <[email protected]> wrote: >> >> Good morning, >> >> I’m looking into replacing our framework developed for EOF that can >> generated an audit document describing what database operations are >> performed when saveChanges() is called. >> >> We capture the object identity, its entity and attributes changed including >> before and after values. >> >> I’m trying to do hook into Cayenne right now to just print the entities >> changed and the attributes before and after values to explore how we would >> do this in Cayenne. >> >> ChatGPT suggested implementing DataChannelSyncFilter and adding a module to >> set it up during configuration. It looks pretty close to what I need except >> it does not compile. So it may be hallucinating. >> >> I would prefer if the hook can be set up right there before calling >> commitChanges(). Because not everything is audited. >> >> Thanks in advance, >> Ricardo Parada
