• 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
Use of abstract entities with relationships
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Use of abstract entities with relationships


  • Subject: Use of abstract entities with relationships
  • From: Michael Rutt <email@hidden>
  • Date: Wed, 26 Apr 2006 20:25:49 -0400

I'm working on my first Core Data application and am running into some issues with abstract entities and relationships. I have been Googling and searching these lists for two days and have not been able to find a clear answer to my problem, so I'm hoping someone can give me a hand with this! Basically, I'm trying to code to the base (generic) entities rather than the specific entities that inherit from them.

Example: I have an abstract entity called account. That account has two relationships, one is parent (which is one-to-one with Account) and one is children (which is one-to-many with Account). Basically this allows for a file-system like structure. Then I specialize the numerous account types available as entities with Account as their parent. So I might have a SalesAccount entity and a PurchaseAccount entity. If I create a SalesAccount entity and want to give it a child of PurchaseAccount, I get an error saying:

Unacceptable type of value for to-one relationship: property = "parent"; desired type = Account; given type = SalesAccount; ... etc.

So my question is, are relationships to abstract entities even possible? And if so, how does one go about creating a specialized entity and assigning it to the relationship? If there isn't an "easy" way, I was considering creating some fetched requests to get the children relationships...

Maybe the answer is as simple as me not fully understanding the Core Data modeling concept and how it should work. I was just trying to keep it generic (like classes) vs. creating relationships between all the non-abstract account types...

Any input would be GREATLY appreciated!

Thanks
Mike
_______________________________________________
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


  • Prev by Date: NSTextTable
  • Next by Date: Re: NSTextTable
  • Previous by thread: Re: NSTextTable
  • Next by thread: unit test subclassing
  • Index(es):
    • Date
    • Thread