Re: Objects marked for delete fall into the updated objects bucket in processRecentChanges
Re: Objects marked for delete fall into the updated objects bucket in processRecentChanges
- Subject: Re: Objects marked for delete fall into the updated objects bucket in processRecentChanges
- From: email@hidden
- Date: Mon, 4 Aug 2008 14:56:30 -0400
Hi Kieran,
I tried this solution just now but I
couldn't get it to work for me. I even trashed my entire build directory
and tried it to no avail. I still see the same behavior namely:
1) deleted EO causes "validateForSave"
exception in ec.saveChanges()
The validation exception is still the
same and related to the mandatory relationship that was nullified by calling
"ec.deleteObject()". The validation exception is not related
to the nullability of the foreign key.
I do not know why the eo is moving from
the "deleted -> updated" bucket.
Thanks for your ideas though,
-- Aaron
Kieran Kelleher <email@hidden> wrote
on 04-08-2008 02:08:55 PM:
> Er ......
>
> On Aug 4, 2008, at 1:39 PM, email@hidden wrote:
>
>
> Hi Kieran,
>
> That is an interesting thought. To mark the relationship as
> "Mandatory" but yet leave the foreign key itself as optional
> ("allows null"). You would think the two would need to back
each
> other up though, and to a casual developer passing by and perusing
> your model he might think you were sloppy,
> he might, but the customers and endusers appreciate
the lack of "A
> System Error has Occurred" messages! The database NOT NULL is
> enforcing the foreign key presence so who cares.
>
> or at least not be sure if the relationship should truly be
> "mandatory" or "optional".
> Well, just tell the team mates about the situation
and they will
> accept it ........ if not, then buy them a Guinness and try again
to
> explain and I am sure they will be OK after that ;-)
>
>
>
> I understand you are brainstorming here.
>
> not really ... just a simple workaround to an annoying problem that
> manifests itself *sometimes* in the WO Frameworks and I am too busy
> to figure out the "why WO does that" part!
>
> Thank you for that. But what led you down the path to this solution?
> Deadlines .... "Necessity is the mother
of invention" ..... aka
> "Deadlines are the mother of getting things done." :-)
>
> Can you shed some light on why an object in the "deleted"
bucket
> would get moved to the "updated" bucket during the various
> processing that happens when you call ec.saveChanges()...
> particularly suspect of "processRecentChanges()" ?
> Not without spending time investigating .....
and no time for that
> while things need to get done....
>
>
>
> What exactly is happening under the covers to make the "allows
null"
> option work?
> The nullified foreign key passes the validateForSave
>
> Try it and let us know if it fixes your problem.
>
>
>
> Thank you,
> -- Aaron
>
>
>
> Kieran Kelleher <email@hidden> wrote on 04-08-2008 12:41:43
PM:
>
> > If I have understood you correctly, then this is how I prevent
this
> > error for mandatory relationships:
> >
> > 1) Make the relationship foreigh key attribute "AllowNull"
in the eomodel
> > 2) Make them NOT NULL in the database (therby ensuring a record
with
> > NULL foreign key can never be saved or updated anyway
> > 3) Set the relationship as mandatory in the EOModel
> >
> > .... consequences is that your problem goes away, but EntityModeler
> > will give you wanrings about mandatory relationship but foreign
key
> > allows null .....
> >
> > HTH & YMMV, Kieran
> > _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden