cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kuhns, John" <>
Subject preDelete question
Date Wed, 13 Jul 2011 16:14:53 GMT
I've come across a situation where I need to short-circuit all database writes and deletes
for a third-party application. I am using Cayenne 3.0. On the prePersist and preUpdate callbacks,
the data object state is set to modified or new, so I can flip it to committed and call the
library methods for persisting the data. For preDelete, the state is committed and doesn't
flip to deleted until after the callback. I can and have worked around this, but was wondering
why the discrepancy exists.

The only thing I can think of is that the data object content is emptied upon deletion so
the values wouldn't be available in the preDelete callback. If there is some method of cancelling
the delete within a prePersist callback I'd like to know about it. If not, I think this is
a necessary addition to the framework. Maybe a this.getObjectContext().pendingDeletedObjects()
that can be manipulated to remove an object from the list and short-circuit the delete?


View raw message