cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject Re: check for changes before commit
Date Fri, 23 Nov 2012 11:22:48 GMT
> Yeah this is a familiar problem, which essentially comes down to the fact
> that while Cayenne has all the info for change tracking, the API to use it
> is somewhat complex. In Cayenne 3.1 we provide a better way (that we still
> need to document), based on lifecycle events and a few extensions in
> cayenne-lifecycle.jar. So here is how you might approach it:

Thank you for your example. I've seen lifecycle mentioned somewhere before but I didn't know
how to use it. Well, I still don't know how to get these two lines into my tapestry app where
everything is inversion of control:

> runtime.getDataDomain().getEntityResolver().getCallbackRegistry().addListener(new LastModifiedListener());
> runtime.getDataDomain().addFilter(new ChangeSetFilter());

I use tapestr5-cayenne so I simply put a dependency in my pom.xml and use it like e. g. @Inject
ObjectContextProvider provider

The only class in the TapestryCayenneModule that uses a private field ServerRuntime is DataContextProviderImpl
(implements ObjectContextProvider), a service that gets not only bound but also overridden
in TapestryCayenneModule, so that I can't override it in my own (where I could
add those two lines from your example). :(

Just to make sure I'm not mistaken: runtime in your example is ServerRuntime and there should
be only one runtime? I need to get the runtime that is used in the TapestryCayenneModule where
my Cayenne contexts are coming from?

I also tried to use the Cayenne Modeler to add the listener, but it's only possible on the
object entity level. Adding an entity-listener to the map.xml produced the warning that DataMap
listeners are no longer supported. It would've solved only half of my problem anyway cause
I need to add the filter, too.

Guess I need to ask some questions on the tapestry mailing list next ... ;)

BTW: Where could I find the schema for the map?
The link on the cayenne website doesn't work:
--> Not Found
Same for


View raw message