Fwd: EOF Key NULL problem

Thomas Ganter <[email protected]>
Newsgroups gmane.comp.web.webobjects.eof
Message-ID <[email protected]>
Dear all,

for two days now I am bugged by a strange behaviour I never encountered 
before. The short version is, that I have two Entities, entA and entB, 
with a one-to-many relationship between them, that is, there is a 
'entb' to-one relationship in entA and a 'entas' to-many relationship 
in entB.

Now, whenever I fetch an instance of entB, say instB, and do the 
following (sligtly abbreviated):

instA = createAndInsertInstance( "entA" );
instA. setEntB( instB );
instB. addToEntA( instA );     (*)
saveChanges();

The result depends on whether line (*) is in the code or not.

WITH (*), I see a SQL string that contains a NULL value for the foreign 
key, whereas WITHOUT (*), everything works fine and the foreign key 
value is copied correctly from instB to instA.

This is independent from the foreign key being a class property or not.

Furthermore, even if I set my foreign key manually, it is completely 
ignored and the above-described behaviour remains (that is, the foreign 
key value that already was set in the instance is nullified somewhere 
on the way to the database).

Yes, I tried addToBothSidesOfRelationshipWithKey, but to no avail.

Any clue what it is I am doing wrong?

- Thomas
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.