Interesting, you are correct.  I'm not sure I'd call that desired behavior
though (although that's good to know). 😆 It also clears out the FK
property in the source object which isn't really what I was going for.



On Wed, Dec 12, 2018 at 11:32 PM Andrus Adamchik <and...@objectstyle.org>
wrote:

> I haven't tried this myself, but what happens if you eagerly prefetch this
> relationship? I suspect Cayenne would just set this property to null and
> there will be no FFE.
>
> Andrus
>
> > On Dec 13, 2018, at 12:35 AM, Lon Varscsak <lon.varsc...@gmail.com>
> wrote:
> >
> > In an PostLoad method I could check for the objects existence and create
> > one on the fly, but I really would prefer to only do this in the case of
> an
> > exception so that I don't have to fire this check in EVERY instance of
> > fetching an Order, only when someone encounters the problem.  Not sure
> how
> > to do that without forcing OriginCode to fetch for every Order fetched
> 100%
> > of the time.
> >
> > On Wed, Dec 12, 2018 at 1:36 PM Lon Varscsak <lon.varsc...@gmail.com>
> wrote:
> >
> >> When the code goes to try to access the Order->OriginCode.getProperty()
> it
> >> goes to fire the fault and will trigger that exception.
> >>
> >> On Tue, Dec 11, 2018 at 5:58 PM Emerson Castañeda <eme...@gmail.com>
> >> wrote:
> >>
> >>> hi Lon
> >>>
> >>> What is the FaultFailureException message you are getting? and when? I
> >>> guess during the insertion by using a not existent FK, right?
> >>>
> >>> if  it is not the case, please provide details in order to understand
> the
> >>> full context!
> >>>
> >>> Thanks
> >>>
> >>> EmeCas
> >>>
> >>> On Tue, Dec 11, 2018 at 7:51 PM Lon Varscsak <lon.varsc...@gmail.com>
> >>> wrote:
> >>>
> >>>> Okay, so I have a situation where I have a FK to a table where the DBA
> >>> was
> >>>> allowing objects to be deleted.  Think Order to OriginCode (basically
> a
> >>> way
> >>>> to know which catalog the order came from)...but the OriginCode record
> >>> has
> >>>> been deleted.  I'm going to put a stop to that, but in the meantime I
> >>> need
> >>>> someway to deal with these Orders still.
> >>>>
> >>>> Any thoughts on how I could handle this FaultFailureException and
> >>> quietly
> >>>> insert a dummy object (maybe onPostLoad in Order)?
> >>>>
> >>>> Thanks,
> >>>>
> >>>> Lon
> >>>>
> >>>
> >>
>
>

Reply via email to