• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
addObjectToBothSidesOfRelationshipWithKey still working?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

addObjectToBothSidesOfRelationshipWithKey still working?


  • Subject: addObjectToBothSidesOfRelationshipWithKey still working?
  • From: Jean Pierre Malrieu <email@hidden>
  • Date: Fri, 15 Sep 2006 01:31:03 +0200

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@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Prev by Date: [MEETING] Toronto Area Cocoa & WebObjects Developer Group - October 10
  • Next by Date: AjaxUpdateContainer function not defined
  • Previous by thread: [MEETING] Toronto Area Cocoa & WebObjects Developer Group - October 10
  • Next by thread: Re: addObjectToBothSidesOfRelationshipWithKey still working?
  • Index(es):
    • Date
    • Thread