I have been using addObjectToBothSidesOfRelationshipWithKey reliably for years now, and since I upgraded to WO 5.3.2 ( the version that comes with XCode 2.4) I am seing strange problems. I can't believe there is bug in there... but... First, a question: from a database standpoint, is it OK to have a too many relationship with no (to-one) reverse relationship? I have settup a test case like this: EntityA: { attributes = ( { allowsNull = N; columnName = iD; externalType = INTEGER; name = iD; valueClassName = NSNumber; valueType = i; } ); className = EntityA; classProperties = ( entityAs ); externalName = EntityA; internalInfo = {}; name = EntityA; primaryKeyAttributes = ( iD ); relationships = ( { destination = EntityB; isToMany = Y; joinSemantic = EOInnerJoin; joins = ( { destinationAttribute = fK; sourceAttribute = iD; } ); name = entityBs; } ); } EntityB: { attributes = ( { columnName = fK; externalType = INTEGER; name = fK; valueClassName = NSNumber; valueType = i; }, { allowsNull = N; columnName = iD; name = iD; } ); className = EntityB; externalName = EntityB; internalInfo = {}; name = EntityB; primaryKeyAttributes = ( iD ); } in EntityA.java: public NSArray entityBs() { return (NSArray)storedValueForKey("entityBs"); } public void setEntityBs(NSArray value) { takeStoredValueForKey(value, "entityBs"); } public void addToEntityBs(EntityB object) { includeObjectIntoPropertyWithKey(object, "entityBs"); } public void removeFromEntityBs(EntityB object) { excludeObjectFromPropertyWithKey(object, "entityBs"); } In Main.java: public void test() { EOEditingContext ec = session().defaultEditingContext(); EntityA a = new EntityA(); EntityB b = new EntityB(); ec.insertObject(a); ec.insertObject(b); a.addObjectToBothSidesOfRelationshipWithKey(b, "entityBs"); } When I run the app and call the test function, I get the following exception: java.lang.IllegalArgumentException: While trying to invoke the set method "public void EntityA.setEntityBs(com.webobjects.foundation.NSArray)" on an object of type EntityA we received an argument of type EntityB. This often happens if you forget to use a formatter. I am probably overlooking something obvious. But what? Thanks for your help. JPM |
_______________________________________________ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list ([email protected]) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com
This email sent to [email protected]
