• 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
Re: Can't update a toMany relationship [SOLVED](a bit less of newbie)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Can't update a toMany relationship [SOLVED](a bit less of newbie)


  • Subject: Re: Can't update a toMany relationship [SOLVED](a bit less of newbie)
  • From: Louis Demers <email@hidden>
  • Date: Sat, 21 Jan 2006 14:45:00 -0500

Finally figured out the problem. Here is how I zoomed in the solution.

1) To see if the problem is in the way I hooked up the TOManyRelationship or coded my objects, I created a Direct2Web apps based on my eomodeled. The problem persisted. The D2W apps crashed.

2) So I assume it was either in my eomodel or in the database. I then compared my eomodel to some examples (Movies.eomodeld). Nothing seemed out of place.

3) I decided to inspect the databse and the data and realized that my NetWorkInterface contained a foreighn key that could be null (because a network interface card can exist without being installed into a comptuer) but the way the database was initialized, those foreign keys were set to 0 and not set to null ( I used phppgAdmin ot inspect and set all my foreighn keys to null). Everythign started working nicely.

What was hapenning was tha upon assigning a networkinterface to a networkdevice, it had to first remove the networkinterface from its previous networkdevice but
since that foreighn key was not properly identiified as null, but as 0, it looked for a networkdevice with primary key 0 (which didn't exit) and crashed.


I was stumped for so long because the error message:

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

really pointed my towrad an object/class typing error.



At 2:09 AM -0500 2006/01/20, Louis Demers wrote:
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.


--

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


References: 
 >Can't update a toMany relationship (newbie Alert) (From: Louis Demers <email@hidden>)

  • Prev by Date: No template found for component Main at jar:file
  • Next by Date: Re: Couting the objects that would be returned by a fetch specification
  • Previous by thread: Can't update a toMany relationship (newbie Alert)
  • Next by thread: Re: How to programmatically send a form (Dev WO)
  • Index(es):
    • Date
    • Thread