On Jun 21, 2011, at 11:12 AM, Chuck Hill wrote: > HI Peer, > > On Jun 21, 2011, at 5:05 AM, Peer Sandtner wrote: >> >> I’m having a strange problem saving an object with a specific >> to-one-relationship. The value for the relationship is set through a >> WOPopupButton (containing object "A" and "B"); these two objects already >> exist in the database. > > Is either one set on the object before you do this editing? > > >> Just before calling ec.saveChanges() the relationship contains object "B" >> (verified by means of debugger). But what gets saved into the database is >> object "A". BTW: The "set" method for the to-one-relationship is not touched >> by anyone after calling saveChanges. >> >> I definitely need some help. ;-) > > :-) > > Is there a relationship from A and B back to this object? I am thinking that > perhaps the relationship is only getting set half way and what you are seeing > is the result of that. > > Is there anything in your validate... methods that could be responsible for > this?
OR: Would this possibly be a part of a compound foreign key for a different relationship on the The first Table? For example: Enrollment.schoolStudent is a relationship based on a schoolId and a studentId attributes Enrollment.school is a relationship based on the schoolId If you set the school relationship without also setting the schoolStudent relationship, you're asking for trouble. (this is why I very rarely use compound PKs) OR: Is the FK attribute for the relationship also a class property? If it is, then you'll need to not just set the relationship, but the property too. This is why you don't ever make an FK a class property. Dave _______________________________________________ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com