Hi:) I've got a couple question for the next hours as I was "storing" them to find the answer by myself, but I couldn't resolve a couple of them.
So this one is a oneToOne relationship, with is specified in both entities A and B.
But when I call both addObjectsToBothSide... only A gets updated...
Here's my code:
//I'm created the relationship when I create and insert A into the ec public EOGenericRecord object() { if (object == null) { object = (A)EOUtilities.createAndInsertInstance(ec, "A"); ((A)object).setARelationship(b()); } return object; }
//This is called when B is requested public B b() { if (b == null) { b = (B)EOUtilities.createAndInsertInstance(ec, "B"); } return b; }
// calling saveChanges() later
//In my framework, here's what I have for setARelationship public void setARelationship(B aValue) { if( log.isDebugEnabled() ) log.debug( "updating b from "+b()+" to "+aValue ); if( aValue == null ) { B object = b(); if( object != null ) removeObjectFromBothSidesOfRelationshipWithKey( object, "b" ); } else addObjectToBothSidesOfRelationshipWithKey( aValue, "b" ); }
A and B have a foreign key to each other, but only A gets it... B's foreign key stay "null".
Anyone see what I'm doing wrong?
Thanks:)
Xavier |