• 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
Can't update a toMany relationship (newbie Alert)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Can't update a toMany relationship (newbie Alert)


  • Subject: Can't update a toMany relationship (newbie Alert)
  • From: Louis Demers <email@hidden>
  • Date: Fri, 20 Jan 2006 02:09:30 -0500

Title: Can't update a toMany relationship (newbie Alert)
Ok, I've been banging my head for more than 2 weeks on this one. Moved to something else to get some distance, But I still can't fix this.

Background:

I'm trying to develop a small app (as a too an learning experience before moving on to something bigger) to manage our ip addresses and generate automatically (eventually the dns configuration files). I have NetworkDevices (computers, printers...) and NetworkInterfaces ( actual ethernet cards, wifi, .... ) entities. One NetworkDevice can have multiple NetworkInterface (where the to many relationship happens).

The java code is the one generated automatically by EOModeler, no modifications (see below shortened versions)

In the wod, my  WOToManyRelationship is wired as


ToManyRelationship: WOToManyRelationship {
        sourceEntityName = "NetworkDevice";
     sourceObject = networkdeviceDisplayGroup.selectedObject;
        relationshipKey = "networkinterfaces";
  destinationDisplayKey = "ethernet";
}

Also it is in a WOForm (with multipleSubmit set to true because I have multiple summit buttons 8-).

Problem: Exception is thrown when I try to save changes after changing selection in the WOToManyRelationship

java.lang.IllegalArgumentException: removeObjectToPropertyWithKey: the key networkinterfaces is not a Array or one of its subclasses - unable to remove the value.

(Strack Trace at the end of the e-mail)


in EOModeler, my models and relationshisp are defined as

NetworkDevice                           NetworkInterface
        pk                                      pk
        inventoryNumber                         ethernet
        model                                   ipexternal
        os                                      fk (foreign key)
        ....                                    ...
        ---------                               ---------
        networkinterfaces  ------------->>      networkdevice




        Name            Source Att      Destination             Destination Att
>  networkdevice        fk              NetworkDevice           pk              (in NetworkInterface)
>> networkinterfaces    pk              NetworkInterface        fk              (in NetworkDevice)


My database is postgres 8.0,
Xcode 2.2.1
Component versions
Xcode IDE: 656.0
Xcode Core: 660.0
ToolSupport: 651.0
EOModeler 5.3
WebObjects Builder 5.3.1(680)



---- Here are portions of generated classes ( By EOModeler) ----

public class NetworkDevice extends EOGenericRecord {
...

   
public NSArray networkinterfaces() {
       
return (NSArray)storedValueForKey("networkinterfaces");
    }

   
public void setNetworkinterfaces(NSArray value) {
        takeStoredValueForKey(value,
"networkinterfaces");
    }

   
public void addToNetworkinterfaces(EOEnterpriseObject object) {
        includeObjectIntoPropertyWithKey(object,
"networkinterfaces");
    }

   
public void removeFromNetworkinterfaces(EOEnterpriseObject object) {
        excludeObjectFromPropertyWithKey(object,
"networkinterfaces");
    }

public class NetworkInterface extends EOGenericRecord {

...

   
public NetworkDevice networkdevice() {
       
return (NetworkDevice)storedValueForKey("networkdevice");
    }

   
public void setNetworkdevice(NetworkDevice value) {
        takeStoredValueForKey(value,
"networkdevice");
    }

---- Here is the stack trace ----

java.lang.IllegalArgumentException: removeObjectToPropertyWithKey: the key networkinterfaces is not a Array or one of its subclasses - unable to remove the value.
      at com.webobjects.eocontrol.EOCustomObject.excludeObjectFromPropertyWithKey(EOCustomObject.java:987)
    at NetworkDevice.removeFromNetworkinterfaces(NetworkDevice.java:88)
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:324)
     at com.webobjects.foundation.NSSelector._safeInvokeMethod(NSSelector.java:120)
  at com.webobjects.eocontrol.EOCustomObject.removeObjectFromPropertyWithKey(EOCustomObject.java:1011)
    at com.webobjects.eocontrol.EOCustomObject.addObjectToBothSidesOfRelationshipWithKey(EOCustomObject.java:1053)
  at com.webobjects.woextensions.WOToManyRelationship.updateSourceObject(WOToManyRelationship.java:384)
        at com.webobjects.woextensions.WOToManyRelationship.setSelections(WOToManyRelationship.java:421)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:324)
     at com.webobjects.foundation.NSKeyValueCoding$1.setMethodValue(NSKeyValueCoding.java:688)
       at com.webobjects.foundation.NSKeyValueCoding$_MethodBinding.setValueInObject(NSKeyValueCoding.java:1175)
       at com.webobjects.foundation.NSKeyValueCoding$DefaultImplementation.takeValueForKey(NSKeyValueCoding.java:1293)
at com.webobjects.appserver.WOComponent.takeValueForKey(WOComponent.java:1550)
  at com.webobjects.foundation.NSKeyValueCoding$Utility.takeValueForKey(NSKeyValueCoding.java:519)
        at com.webobjects.foundation.NSValidation$DefaultImplementation.validateTakeValueForKeyPath(NSValidation.java[2006-01-20 01:22:14 EST] <WorkerThread0> <com.webobjects.appserver._private.WOComponentRequestHandler>: Exception occurred while handling request:
java.lang.IllegalArgumentException: removeObjectToPropertyWithKey: the key networkinterfaces is not a Array or one of its subclasses - unable to remove the value.
:733)
at com.webobjects.appserver.WOComponent.validateTakeValueForKeyPath(WOComponent.java:1273)
      at com.webobjects.appserver._private.WOKeyValueAssociation.setValue(WOKeyValueAssociation.java:71)
      at com.webobjects.appserver._private.WOBrowser._fastTakeValuesFromRequest(WOBrowser.java:153)
   at com.webobjects.appserver._private.WOBrowser.takeValuesFromRequest(WOBrowser.java:168)
        at com.webobjects.appserver._private.WODynamicGroup.takeChildrenValuesFromRequest(WODynamicGroup.java:81)
       at com.webobjects.appserver._private.WODynamicGroup.takeValuesFromRequest(WODynamicGroup.java:89)
       at com.webobjects.appserver._private.WOConditional.takeValuesFromRequest(WOConditional.java:41)
at com.webobjects.appserver._private.WODynamicGroup.takeChildrenValuesFromRequest(WODynamicGroup.java:81)
       at com.webobjects.appserver._private.WODynamicGroup.takeValuesFromRequest(WODynamicGroup.java:89)
       at com.webobjects.appserver.WOComponent.takeValuesFromRequest(WOComponent.java:914)
     at com.webobjects.appserver._private.WOComponentReference.takeValuesFromRequest(WOComponentReference.java:97)
   at com.webobjects.appserver._private.WODynamicGroup.takeChildrenValuesFromRequest(WODynamicGroup.java:81)
       at com.webobjects.appserver._private.WODynamicGroup.takeValuesFromRequest(WODynamicGroup.java:89)
       at com.webobjects.appserver._private.WOConditional.takeValuesFromRequest(WOConditional.java:41)
at com.webobjects.appserver._private.WODynamicGroup.takeChildrenValuesFromRequest(WODynamicGroup.java:81)
       at com.webobjects.appserver._private.WODynamicGroup.takeValuesFromRequest(WODynamicGroup.java:89)
       at com.webobjects.appserver._private.WOForm.takeValuesFromRequest(WOForm.java:70)
       at com.webobjects.appserver._private.WODynamicGroup.takeChildrenValuesFromRequest(WODynamicGroup.java:81)
       at com.webobjects.appserver._private.WODynamicGroup.takeValuesFromRequest(WODynamicGroup.java:89)
       at com.webobjects.appserver.WOComponent.takeValuesFromRequest(WOComponent.java:914)
     at com.webobjects.appserver.WOSession.takeValuesFromRequest(WOSession.java:1139)
        at com.webobjects.appserver.WOApplication.takeValuesFromRequest(WOApplication.java:1350)
        at com.webobjects.appserver._private.WOComponentRequestHandler._dispatchWithPreparedPage(WOComponentRequestHandler.java:189)
    at com.webobjects.appserver._private.WOComponentRequestHandler._dispatchWithPreparedSession(WOComponentRequestHandler.java:287)
at com.webobjects.appserver._private.WOComponentRequestHandler._dispatchWithPreparedApplication(WOComponentRequestHandler.java:322)
     at com.webobjects.appserver._private.WOComponentRequestHandler._handleRequest(WOComponentRequestHandler.java:358)
       at com.webobjects.appserver._private.WOComponentRequestHandler.handleRequest(WOComponentRequestHandler.java:432)
        at com.webobjects.appserver.WOApplication.dispatchRequest(WOApplication.java:1306)
        at com.webobjects.appserver._private.WOWorkerThread.runOnce(WOWorkerThread.java:173)
    at com.webobjects.appserver._private.WOWorkerThread.run(WOWorkerThread.java:254)
        at java.lang.Thread.run(Thread.java:552)
--

Louis Demers ing.
email@hidden
 _______________________________________________
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

  • Follow-Ups:
    • Re: Can't update a toMany relationship [SOLVED](a bit less of newbie)
      • From: Louis Demers <email@hidden>
  • Prev by Date: Re: How to use datetime and boolean?
  • Next by Date: Re: How to programmatically send a form (Dev WO)
  • Previous by thread: EO with Japanese value
  • Next by thread: Re: Can't update a toMany relationship [SOLVED](a bit less of newbie)
  • Index(es):
    • Date
    • Thread