Re: Core Data SQL store looses data that XML store does not
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: mmalcolm crawford <email@hidden>
- Date: Wed, 10 Aug 2005 00:13:21 -0700
On Aug 9, 2005, at 11:18 AM, Scott Ellsworth wrote:
My Location entity has six toMany relationships to itself. There
are no reverse relationships set for these, because I rarely care
about the other direction
This is almost certainly the issue.
If you don't specify the reverse relationships, then Core Data cannot
know whether the reverse is intended to be to-one or to-many, so it
defaults to to-one. If (as *appears* to be the case) you're
expecting the relationship to be many-to-many, then you'll run into
problems...
(Since Core Data assumes an unspecified inverse is a to-one, "it
creates a foreign key column in the destination table. If the
destination object can be part of more than one source object's
relationship, this column gets overwritten as source objects are
saved".)
Take-home point: You should always model to-many relationships in
both directions.
Filed as bug 4204193.
Actually filed as bug 4204139.
(Curiously, 4204193 was filed by Scott too...)
mmalc
(With thanks to Melissa.)
_______________________________________________
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