• 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: Mapping Model
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Mapping Model


  • Subject: Re: Mapping Model
  • From: Keary Suska <email@hidden>
  • Date: Mon, 23 Aug 2010 12:43:20 -0600

On Aug 23, 2010, at 11:06 AM, Amy Heavey wrote:

> Hi,
>
> I've got a core data app that I'm working on, and I started off with quite simple relationships. I've got a products entity, and a purchase order entity, which had many to m any relationships between them. I now need to be able to set a quantity for each product in each purchase order. I think I need to set up an inbetween entity, (called purchaseOrderItem) which stores the quantity for each product, and has relationships to the product and purchase order entity.
>
> I can set it all  up in the datamodel, but to be able to use the data already in the app I need to migrate it over. I expect to initially set all quantites to 1, but I can't work out how to set up the mapping model so it moves the relationships correctly.
>
> Can anyone point me in the right direction?
>
> data model 1.0
> Entities: 			Product, PurchaseOrder
> Relationships: 	Product <<---->>PurchaseOrder
>
> data model 1.1
> Entities: 			Product, PurchaseOrder, PurchaseOrderItem
> Relationships: 	Product <---->> PurchaseOrderItem
> 				PurchaseOrderItem <<----> PurchaseOrder

I wouldn't change the existing relationship(s)--create new ones instead. You will have to subclass NSEntityMigrationPolicy to create appropriate "PurchaseOrderItem" relationships from the "Product" relationships.

Have you read this doc:
http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/CoreDataVersioning/Articles/vmMigrationProcess.html#//apple_ref/doc/uid/TP40005508-SW4 ?

HTH,

Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"

_______________________________________________

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

References: 
 >Mapping Model (From: Amy Heavey <email@hidden>)

  • Prev by Date: Mapping Model
  • Next by Date: Workaround for "Symbol not found: _SCDynamicStoreCreate" on 10.4?
  • Previous by thread: Mapping Model
  • Next by thread: Workaround for "Symbol not found: _SCDynamicStoreCreate" on 10.4?
  • Index(es):
    • Date
    • Thread