cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrey Razumovsky <razumovsky.and...@gmail.com>
Subject Re: How can I handle validation exception?
Date Thu, 12 Mar 2009 08:21:45 GMT
Hi Νίκος,

What version of Cayenne are you using? I can swear that in 3.0Mx it is
validation exception thrown. If it is CayenneRuntimeException, probably
there's other error during commit. Can you give the stack trace of your
CayenneRuntimeException?

Andrey

2009/3/12 Νίκος Παράσχου <niparasc@gmail.com>

> validatingObjectsOnCommit is true and there are changes in the context.
> The overrided method validateForSave, in the object class produced by
> cayenne modeller, is called.
>
> The problem is that commitChanges() doesn't throw directly a
> ValidationException so I cannot catch it in the catch block (it throws a
> CayenneRuntimeException).
>
> How should I handle this exception? I need validationResult in order to
> call getFailures(). How can I retrieve validationResult?
>
> Maybe I am missing something...
>
> Thank you,
> Nikos
>
> Στις 11-03-2009, ημέρα Τετ, και ώρα 15:06 +0200, ο/η Andrus Adamchik
> έγραψε:
> > On Mar 11, 2009, at 11:01 AM, Νίκος Παράσχου wrote:
> >
> > > Is there any way to do something like the following:
> > >
> > > try {
> > >     context.commitChanges();
> > > }
> > > catch(Some ValidationException thrown earlier) {
> > >     // Get failures list and print error messages.
> > > }
> >
> > This is how it should be done, and this works for me at least. Not
> > sure why it does not work for you. Can you doublecheck that
> > validatingObjectsOnCommit is actually true and there are changes in
> > the context?
> >
> > Andrus
>
>

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