Re: Inserting records into to-many relationship
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