Re: Core data: Inverse relationships with subclasses
Re: Core data: Inverse relationships with subclasses
- Subject: Re: Core data: Inverse relationships with subclasses
- From: Gideon King <email@hidden>
- Date: Thu, 30 Sep 2010 08:25:11 +1000
Thanks but no, it's an atomic store which gets written to XML.
Regards
Gideon
On 30/09/2010, at 2:19 AM, jeremy wrote:
> If your data store is SQLite, I believe the problem is the subclass FooSub.
>
> Since FooSub is a subclass of Foo, CoreData combines both Foo and FooSub into a single table whose columns include all properties from Foo AND FooSub.
>
> Consequently, when you create a new instance of Foo, columns from FooSub may contain invalid data.
>
> You can easily verify this by opening your SQLite database store with SQLite Database Browser, found at:
>
> http://sqlitebrowser.sourceforge.net
>
> For a solution, rework your schema to subclass FooSub directly from NSManagedObject.
>
>
> On Sep 29, 2010, at 9:28 AM, Gideon King wrote:
>
>> Hi, I have a bidirectional one to one relationship between two entities like this:
>>
>> Foo <-> Bar, and Foo has a subclass FooSub. All entities are concrete.
>>
>> Sometimes when I set the inverse relationship it's like this aBar.toFoo = aFoo, and this works fine, but when it's linking back to the subclass, aBar.toFoo = aFooSub, it fails with a validation error: toFoo is not valid, dangling reference to an invalid object = null.
>>
>> I would have thought it would be OK for the relationship to point to an instance of FooSub shouldn't it? After all, it is a subclass of Foo. Or do things work differently for subclasses in Core Data? If so, how should I work around this problem?
>
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden