Are you taking about parent/child ObjectContexts? I see you're calling
commitChangesToParent not commitChanges. Does it work when you call
commitChanges instead?

Here's the code I have for the callbacks:

callbackRegistry =
runtime.getDataDomain().getEntityResolver().getCallbackRegistry();

callbackRegistry.addCallback(LifecycleEvent.PRE_UPDATE,
ICSDataObject.class, "willUpdate");

public void willUpdate() {
}

On Tue, Aug 7, 2018 at 12:47 PM Lon Varscsak <lon.varsc...@gmail.com> wrote:

> Hey all,
>
> I've got a data object who has a preUpdate callback so that I can set
> required values (like a timestamp) before update.  According to the docs
> this should work in the parent-child setup, but that doesn't seem to be the
> case.  Thoughts?  Here's a snippet of the stacktrace:
>
> Validation failure for
> com.smarthealth.businesslogic.personalization.ArchiveImage: 'timestamp' is
> a required value.
>
> Validation failure for
> com.smarthealth.businesslogic.personalization.ArchiveImage.timestamp:
> "timestamp"  is required.
>
> Validation failure for
> com.smarthealth.businesslogic.personalization.ArchiveImage: 'timestamp' is
> a required value.
>
> at org.apache.cayenne.access.ObjectStoreGraphDiff.validateAndCheckNoop(
> ObjectStoreGraphDiff.java:113)
>
> at
> org.apache.cayenne.access.DataContext.flushToParent(DataContext.java:734)
>
> at org.apache.cayenne.access.DataContext.commitChangesToParent(
> DataContext.java:682)
>
> at com.smarthealth.wicket.designpal.components.EditorPage.save(
> EditorPage.java:127)
>
>
> The preUpdate callback is never fired.
>
> Thanks,
>
> Lon
>

Reply via email to