cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Scheibe <dscheib...@googlemail.com>
Subject Lifecycle Listeners / cayenne-3.1B1
Date Tue, 05 Mar 2013 15:43:13 GMT
All,

i'm trying to get the lifecycle listeners working for my use case and i've
come accross a problem. I registered a listener to do some extra stuff for
an entity whenever it will be persisted (prePersist) via:

callbackRegistry.addListener(LifecycleEvent.PRE_PERSIST, Content.class,
"prePersist");

This get's called as expected and works smoothly.

Now whenever i have the scenario of a CommitException thrown during
commitChanges() (for whatever reason, underlying database not available,
etc.) i need to revert some of the stuff i did in the "prePersist"
lifefycle callback on the object in question.

Unfortunately i haven't had luck yet to register a lifecycle listener that
will be called in case of a "rollback" through "rollbackChanges".

The documentation states something about "PostLoad" being called "Within
"ObjectContext.rollbackChanges()" after the object is reverted." (although
this is from 3.0 i guess it should still apply?
https://cayenne.apache.org/docs/3.0/lifecycle-callbacks.html)

Is there any chance to get a kind of a "postRollback" lifecycle callback
working or something similar? Or did i just hit a bug with the version i'm
using?

Any help is much appreciated.

Cheers,
Daniel

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message