• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Objects marked for delete fall into the updated objects bucket in processRecentChanges
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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 13:39:58 -0400


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, or at least not be sure if the relationship should truly be "mandatory" or "optional".

I understand you are brainstorming here. Thank you for that. But what led you down the path to this solution? 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()" ?

What exactly is happening under the covers to make the "allows null" option work?

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

>
> On Aug 4, 2008, at 11:21 AM, email@hidden wrote:

>
>
> Hello WOrriors,
>
> We're using WO 5.3.x (not 5.4.x)
>
> I've run into a pickle where if I do an ec.deleteObject() and then
> call ec.saveChanges() I find that this fails during a
> "validateFor*Save*". Curious, indeed, because it should only call
> "validateFor*Delete*". When asking the EC to delete the Object, it
> breaks various mandatory relationships. This, in itself, is ok
> because the object is about to go "bye-bye" and is akin to setting a
> variable to null so you don't accidentally try to reference it
> anymore. Problem is, the object is mysteriously being dropped into
> the "updatedObjects" bucket during "processRecentChanges()"... this
> is what kicks off the validateForSave which of course fails because
> mandatory relationships are purposely broken.
>
> Even more of interest is that this strange transfer from "deleted ->
> updated" status only happens in certain repeatable circumstances. It
> happens when you:
>
> 1) On _page A_ in _EC 1_ *edit a value in the desired EO and save*
> 2) then go to a different _page B_ with _EC 2_ but pass the EO as a
> local object of the new EC
> 3) Attempt to delete and save the local EO in _EC 2_ on _page B_.
>
> The above will happen every time. However, if I repeat those above
> steps but "do not edit the EO" in step 1, then everything goes
> according to plan and the object actually deletes.
>
> This is all on my local machine in dev mode with DirectConnect.
> Nothing funny with multiple concurrent access. Strangely, if I step
> into ec.saveChanges() and then ec.processRecentChanges() and step a
> bit there then hit "continue" in the debugger... the marked for
> delete object *stays* in the delete bucket and deletes as desired.
> So odd! It's as if there is a concurrent process going on in
> processRecentChanges that if tripped at the right time, maybe a
> deferred fault (or something) gets fired and causes an object to
> move from the deleted -> updated bucket.
>
> I've searched a bit on the listserv archives and have seen some
> notable people have had similar issues in the past. For example this
> posting between Lenny, Chuck, and Christian:
>
> http://www.mail-archive.com/email@hidden/msg04553.html
>
> I've tried the code fix to EOEditingContext offered here and found
> that it stops the Validation Error but doesn't actually delete the
> desired EO either.
>
> If anyone has any insight on this issue I'm all ears and appreciate
> your thoughts and concern. Anything like:
>
> 1) Is this a confirmed bug by Apple that might be fixed in WO 5.4 or
> at least has an open Radar ticket?
>
> 2) Is there possibly something similar that has bit you that you
> think I also might be doing wrong and overlooking?
>
> 3) Have other peoople used Lenny's fix and had any other thoughts or tweaks?
>
> Thanks in advance,
> -- Aaron _______________________________________________
> 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
 _______________________________________________
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

  • Follow-Ups:
    • Re: Objects marked for delete fall into the updated objects bucket in processRecentChanges
      • From: Kieran Kelleher <email@hidden>
References: 
 >Re: Objects marked for delete fall into the updated objects bucket in processRecentChanges (From: Kieran Kelleher <email@hidden>)

  • Prev by Date: Re: Objects marked for delete fall into the updated objects bucket in processRecentChanges
  • Next by Date: Re: Objects marked for delete fall into the updated objects bucket in processRecentChanges
  • Previous by thread: Re: Objects marked for delete fall into the updated objects bucket in processRecentChanges
  • Next by thread: Re: Objects marked for delete fall into the updated objects bucket in processRecentChanges
  • Index(es):
    • Date
    • Thread