We followed JPA spec and implemented PRE_PERSIST to be called when a new object is registered with the context (i.e. prior to 'commitChanges'). So you you are right - there is no callback for the new objects right before 'commit'.

I suspect there are cases when this is not sufficient (i.e. when you need to change object state based on some other objects state that is only available on commit)... BTW, could you describe your scenario when you need such callback? Maybe there are other ways around.

Also as a temporary workaround you can use the old "callback" CayenneDataObject.validateForInsert()

Andrus


On Oct 17, 2007, at 6:18 AM, Gary Jarrel wrote:

Hi Guys

This maybe a silly question, but is there a callback type which would
be fired before a new record is inserted into the database during the
call to commitChanges()? Doesn't seem like PRE_PERSIST or PRE_UPDATE
does the trick?

Maybe I'm just missing something with these whole callbacks business?

Cheers,

Gary


Reply via email to