Re: Lifecycle Callbacks!

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Fri Oct 12 2007 - 09:23:29 EDT

  • Next message: Robert Zeigler: "Mistake in null-handling doc?"

    Hi Gary,

    You are likely using 3.0M1 that requires explicit enabling of the
    listeners for the DataContext. Check out "Lifecycle Callbacks"
    chapter ("Enabling Callbacks" subchapter) of the Cayenne Guide
    included with the release for the examples.

    3.0M2 that will hopefully be released soon does not require that, so
    we removed that advice from the online docs. You can also use the
    recent snapshot of 3.0 from the Maven repo:

    http://people.apache.org/repo/m2-snapshot-repository/org/apache/cayenne/

    Andrus

    On Oct 12, 2007, at 1:55 PM, Gary Jarrel wrote:

    > Hi Guys!
    >
    > I've just delved into using lifecycle callbacks for the first time,
    > and I can't seem to get my call back to fire in what seems to be a
    > relatively simple code:
    >
    > LifecycleCallbackRegistry registry = context.getEntityResolver()
    > .getCallbackRegistry();
    > LifecycleListener listener = new AttributeChangeListener();
    > registry.addDefaultListener(listener);
    > News news = (News) DataObjectUtils.objectForPK(this.context,
    > News.class, 1);
    > assertNotNull(news);
    > System.err.println(news);
    > news.setBody("test");
    > context.commitChanges();
    > System.err.println(news);
    >
    > I have read over the manual chapter on call backs a few times, and
    > can't seem to find what I'm doing wrong - but it has been a very long
    > day and maybe I'm starting to gone insane!
    >
    > Thank you!
    >
    > Gary
    >



    This archive was generated by hypermail 2.0.0 : Fri Oct 12 2007 - 09:23:58 EDT