Thank you Andrus, good to know I wasn't going mad! I've come across a
post on this list which mentioned enabling callbacks and referred to
the chapter at the end of the Lifecycle Callback user guide called
"Enabling Callbacks" but when I was looking through the guide I could
not see it :)
Thanks again!
Gary
On 10/12/07, Andrus Adamchik <andru..bjectstyle.org> wrote:
> 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 - 22:26:48 EDT