Re: ec.saveChages gives null exception (didn't before)
Re: ec.saveChages gives null exception (didn't before)
- Subject: Re: ec.saveChages gives null exception (didn't before)
- From: Arturo Perez <email@hidden>
- Date: Tue, 08 Mar 2005 10:42:21 -0500
Hi Drew,
Typically the below is done like:
Book = EOUtilities.createAndInsertInstance(ec,"Book");
Student = EOUtilities.createAndInsertInstance(ec,"Student");
student.addObjectToBothSidesOfRelationshipWithKey(book, "theBorrowedBooks");
This takes care of all the primary/foreign key issues.
Colin Clark wrote:
Drew,
As far as I can understand, you don't need to expose the primary key
for this kind of a relationship. I think the problem is that you're
thinking in terms of database design, not in terms of your object model.
On 8-Mar-05, at 6:48 AM, Drew Thoeni wrote:
I do have the primary key exposed, but believe I needed to because
I'm doing "manual" joins to an unflattened table that is a
many-to-many. Here's the snippet of code that does that. Without
access to the key, classNumber(), I don't know how to make that join
happen. Any thoughts? Am I looking at this all wrong?
BookStudent newBSJoin =
(BookStudent)EOUtilities.createAndInsertInstance(ec,"BookStudent");
newBSJoin.setClassNumber(this.classNumber());
I think this may be the problem, as it is the only non-null column.
_______________________________________________
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