• 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: Inserting records into to-many relationship
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Inserting records into to-many relationship


  • Subject: Re: Inserting records into to-many relationship
  • From: Zak Burke <email@hidden>
  • Date: Sun, 14 Aug 2005 09:30:32 -0400

Tanmoy Roy wrote on 8/14/05 2:19 AM:
> Let's say I have a table Author and Books. Primary key of the author
> table is a one up sequernce number from an sequence Author_seq.
> This unique number is bound to the author_id column in the Books table.
> The pkey of the books is also an one up sequence num. from books_seq.
> Now I am setting the author details to the Author object then
> editingContext.insertObject(author) and the coresponding book details to
> Books object in a loop (steps : set book details,
> author.addObjectToBothSidesOfReln.(book),
> editingContext().insertObject(book)) then doing a
> editingContext.saveChanges ().

Always insert into the EC before doing any relationship management. In
this case, make sure your book is in the EC before the
author.addObjectToBothSidesOfRelationshipWithKey() call.

 It gives me an exception that the
> authorId of Books cannot bew null.

Make sure you set the author -->> books relationship to propagate its
primary key.

Good luck,

zak.
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Inserting records into to-many relationship
      • From: Florijan Stamenkovic <email@hidden>
References: 
 >Inserting records into to-many relationship (From: Tanmoy Roy <email@hidden>)

  • Prev by Date: Re: Several newbish questions
  • Next by Date: [OT] How to print a different version with only one click?
  • Previous by thread: Inserting records into to-many relationship
  • Next by thread: Re: Inserting records into to-many relationship
  • Index(es):
    • Date
    • Thread