0

I'm used to using Hibernate in Java applications, and Many-To-One relationships are common there when for creating a link from ObjectA to a ReferenceObjectB. ReferenceObjectB may be an atomic class, that doesn't have any relationships to any other objects. ReferenceObjectB may be used in multiple other objects.

In my iOS app, I am using Core Data for the data model. I have created an ObjectA that has a one-to-many relationship to ReferenceObjectB, and created without an Inverse Relationship, as I want the relationship to act like the Many-To-One from Hibernate.

Seems to work. However, Xcode produces a warning: "Misconfigured Property: TimeItem.extraData should have an inverse" Is this a warning that should be heeded with Core Data, or is it just noise in this situation?

DaveDude
  • 285
  • 1
  • 13
  • Thx for sharing the link to that other article. I will try to use an inverse relationship. However, I still think it's weird to require an inverse all the time. Maybe I am thinking of this wrong - in memory graph model of objects, vs. database level. Like I said in my original question - Hibernate supports something called many-to-one, but when u look at Core Data that term is never mentioned. – DaveDude Mar 03 '14 at 04:13

3 Answers3

0

Warnings are there for a reason. The inverse of the relationship is used internally by Core Data to manage the data store contents as you add and (in particular) remove objects.

Generally, every relationship should have an inverse.

Wain
  • 117,132
  • 14
  • 131
  • 151
-1

Not mandatory, but you'll have a warning. Read this post : http://shanecrawford.org/2008/49/a-warning-about-your-inverse-relationships/

Armand DOHM
  • 1,126
  • 1
  • 7
  • 9
-2

Two-sides relationships needed to correctly manipulate objects when you creating them, or set one entity as property to other entity. Core data can automatically setting some relationships and you do not need do that manually.

Overall using one-side relationships is not always dangerous.

Oleg Sobolev
  • 3,176
  • 2
  • 14
  • 28
  • Using one sided relationships is **always** dangerous. It will, sooner or later, create data corruption. It will always cause data performance issues. – Marcus S. Zarra Mar 03 '14 at 03:52