• 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: Core Data SQL store looses data that XML store does not
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Core Data SQL store looses data that XML store does not


  • Subject: Re: Core Data SQL store looses data that XML store does not
  • From: Jack Nutting <email@hidden>
  • Date: Wed, 17 Aug 2005 21:55:37 +0200

On 8/17/05, Terrence Talbot <email@hidden> wrote:
> I just happen to have a special case where I have an object that will
> have some X in list A and some X in list B and always be the owner
> (the inverse of the relationship) for all objects in either list
> until they are deleted from the context. Is a separate List object
> really the best way to go?

OK, that is a special case.  Hmmm.  How about this:

THING_WITH_LISTS
    aListXs ->> (X)
    bListXs ->> (X)

X
    aListOwner -> (THING_WITH_LISTS)
    bListOwner -> (THING_WITH_LISTS)
    myOwner -> (THING_WITH_LISTS)

So, you create these two sets of inverse relationships

    THING_WITH_LISTS.aListXs <->> X.aListOwner
    THING_WITH_LISTS.bListXs <->> X.bListOwner

but those are bidirectional ONLY to satisfy the requirement that they
must be (in order to not mess up the data store when moving from xml
to sqlite).  What you must do, in code, is to check whenever either
X.aListOwner or X.bListOwner is set (which CoreData will do for you
whenever you attach an X to a bListXs or aListXs relationship), and at
that time manually set X.myOwner to the same.  Then you can be sure
that traversing X.myOwner will always get you back to the right owner.

I still feel like there ought to be a better way to model this, but
it's not quite clear to me yet.

--
// jack
// http://www.nuthole.com
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Core Data SQL store looses data that XML store does not (From: Scott Ellsworth <email@hidden>)
 >Re: Core Data SQL store looses data that XML store does not (From: mmalcolm crawford <email@hidden>)
 >Re: Core Data SQL store looses data that XML store does not (From: Scott Ellsworth <email@hidden>)
 >Re: Core Data SQL store looses data that XML store does not (From: mmalcolm crawford <email@hidden>)
 >Re: Core Data SQL store looses data that XML store does not (From: Terrence Talbot <email@hidden>)
 >Re: Core Data SQL store looses data that XML store does not (From: Jack Nutting <email@hidden>)
 >Re: Core Data SQL store looses data that XML store does not (From: Terrence Talbot <email@hidden>)

  • Prev by Date: Anyone used iTableColumnHeader?
  • Next by Date: init toolbar item frame with custom view (Was: tooltip event/notification?)
  • Previous by thread: Re: Core Data SQL store looses data that XML store does not
  • Next by thread: Newbie warning: watch your NSLog data types
  • Index(es):
    • Date
    • Thread