You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by Bryan Lewis <br...@maine.rr.com> on 2006/04/07 23:43:10 UTC

referential integrity errors

We occasionally get referential integrity errors from some old legacy
data in our database.  In our old WebObjects days such errors were
basically ignored.  When we converted to Cayenne, I duplicated the old
behavior by overriding resolveFault() in our DataObject superclass.

Now that method has moved to DataContext.prepareForAccess() which isn't
as easy to override, so I thought this is a good time to ask... what's
the preferred way to catch these errors in a less drastic way than
throwing a runtime exception?  Thanks.


Re: referential integrity errors

Posted by Mike Kienenberger <mk...@gmail.com>.
> On Apr 8, 2006, at 1:43 AM, Bryan Lewis wrote:
> > We occasionally get referential integrity errors from some old legacy
> > data in our database.  When we converted to Cayenne, I duplicated the
> > old behavior by overriding resolveFault() in our DataObject superclass.

On 4/8/06, Andrus Adamchik <an...@objectstyle.org> wrote:
> Here is a fairly easy way to subclass DataContext - in the Modeler
> you can set a user defined DataContextFactory for a DataDomain.
>
> In the future catching bad faults maybe a good candidate for
> including in the context delegate interface.

I like this idea.  In the past, I had to wrap code that referenced
relationship methods with a try/catch to detect these.

Re: referential integrity errors

Posted by Andrus Adamchik <an...@objectstyle.org>.
On Apr 8, 2006, at 1:43 AM, Bryan Lewis wrote:

> We occasionally get referential integrity errors from some old legacy
> data in our database.  In our old WebObjects days such errors were
> basically ignored.  When we converted to Cayenne, I duplicated the old
> behavior by overriding resolveFault() in our DataObject superclass.
>
> Now that method has moved to DataContext.prepareForAccess() which  
> isn't
> as easy to override, so I thought this is a good time to ask... what's
> the preferred way to catch these errors in a less drastic way than
> throwing a runtime exception?  Thanks.

Hi Bryan,

Here is a fairly easy way to subclass DataContext - in the Modeler  
you can set a user defined DataContextFactory for a DataDomain.

In the future catching bad faults maybe a good candidate for  
including in the context delegate interface.

Andrus