cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lon Varscsak <lon.varsc...@gmail.com>
Subject Re: Problem with Callback not getting called in parent/child setup
Date Tue, 07 Aug 2018 19:09:57 GMT
Yes, in a parent/child object context.  Works fine if I'm committing to the
db.

-Lon

On Tue, Aug 7, 2018 at 10:54 AM John Huss <johnthuss@gmail.com> wrote:

> 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.varscsak@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
> >
>

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