Hi Mike,

We've been gradually moving from "event" to "callback" and model for object 
lifecycle tracking and to "interceptor" model for transaction state tracking. 
In practical terms this means that events dispatched via EventManager should be 
considered internal to the framework (there are probably exceptions to this 
rule, but that's the general direction). User application should instead be 
using callbacks on objects / listeners to receive per-object events and 
DataChannelFilter [1] to intercept transactions. The 2 approaches are 
synergetic and are often combined together [2].

Will that be sufficient for your use cases? 

Andrus


[1] 
http://cayenne.apache.org/docs/3.1/api/org/apache/cayenne/DataChannelFilter.html
[2] 
http://cayenne.apache.org/docs/3.1/cayenne-guide/lifecycle-events.html#comining-listeners-with-datachannelfilters

On Sep 13, 2013, at 9:32 PM, Mike Kienenberger <[email protected]> wrote:
> So I'm finally making the attempt to upgrade my ancient Cayenne
> project from 1.1 to 3.x.
> 
> The one kind of compile error I still haven't resolved is registering
> for a data context commit.
> 
> I know I can register individual PrePersist, PreRemove, and PreUpdate
> callbacks for individual entity types, but I don't see how I be
> notified of with a single DataContext.WILL_COMMIT event once before
> each context.commit().
> 
> 
> I see three problems with trying to use the individual callbacks:
> 
> - Huge performance hit of being notified for each and every entity committed
> 
> - Another performance hit of setting up lifecycle notification by
> iterating through the runtime metadata to register every existing
> entity type for each of the three pre-commit listeners
> 
> and
> 
> - If nothing gets changed by the commit, then I would still get no 
> notification.
> 

Reply via email to