addObjectsToBothSide... not really both side

Dev WO <[email protected]>
Newsgroups gmane.comp.web.webobjects.devel
Message-ID <[email protected]>
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

_______________________________________________
WebObjects-dev mailing list
[email protected]
http://www.omnigroup.com/mailman/listinfo/webobjects-dev
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.