cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bruno René Santos <>
Subject RE: Rollbacks and Listeners
Date Mon, 09 Aug 2010 15:08:51 GMT
I have been analyzing the behaviour of the commitChanges lifecycle and inferred
that only when all database operations that are contained on the current context
are successfully performed do the post... callbacks are called. So if you have
like 4 inserts on the context and one of them raises an exception (because
violates an unique constraint for example), none post-persist callbacks for the
other 3 inserts is called. Is that correct?

Thank you

-----Mensagem original-----
De: Joe Baldwin [] 
Enviada: segunda-feira, 9 de Agosto de 2010 16:02
Assunto: Re: Rollbacks and Listeners

Wouldn't an important business-concern (or rule) be that if there was indeed a
rollback, then one might want to log it (via a Cayenne insert)?

I am doing something like this right now and it is a tad tricky.

On Aug 9, 2010, at 10:37 AM, Mike Kienenberger wrote:

> On Mon, Aug 9, 2010 at 5:41 AM, Bruno René Santos <> wrote:
>> Im using cayenne on a banking system, where commits and rollbacks are
>> I was thinking about using cayenne callbacks to include the creation of logs
>> during database operations. My doubt is what happens when there is a rollback
>> the database during a transaction in terms of callbacks? Do all Pre...
>> are called but no Post.. callbacks? Is there any way to know on the callbacks
>> that the objects were rollbacked?
> As long as you create the audit records in the same transaction as the
> rest of the data, when the transaction is rolled back or committed,
> then the audit logs will be rolled back or committed.   You should not
> have to do anything on a Post, only on a Pre.
> ============
> An old issue on auditing is here.   Not sure how relevant it is for
> 3.0 as I haven't used 3.0 yet.
> Some newer threads on auditing:
> Andrey posted one set of code for doing this here -- read through the
> whole thread.

View raw message