• 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: Debuging WOManyToManyRelationship
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Debuging WOManyToManyRelationship


  • Subject: Re: Debuging WOManyToManyRelationship
  • From: Chuck Hill <email@hidden>
  • Date: Fri, 22 Jul 2005 11:00:32 -0700

Double check all of your awakeFromInsertion and awakeFromFetch to ensure that you are calling super's implementation before doing anything.

Chuck

On Jul 22, 2005, at 4:01 AM, Dev WO wrote:

I've been setting up a form with a WOManyToMany relationship, I tried it and it worked, the correct values were written in the database in the join-table.
I still worked on this project, though I don't remember exactly what I've done...
I had to left this for a couple days and when back on it, I've seen that saving would lead to an exception like the one Amedeo Mantica got on may 19th 2005:
----
[2005-07-22 10:24:51 CEST] <WorkerThread7> java.lang.NullPointerException
at com.webobjects.woextensions.WOToManyRelationship.updateSourceObject (WOToManyRelationship.java:348)
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: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.takeChildrenValuesFro mRequest(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.takeChildrenValuesFro mRequest(WODynamicGroup.java:81)
at com.webobjects.appserver._private.WODynamicGroup.takeValuesFromRequest (WODynamicGroup.ja
----
But has the solution was to change the workflow, it doesn't help me fix my problem...
So let's try to explain it correctly:
-I've got a regular form, and without the WOToMany it works like a charm.
-When adding the WOToMany, the display is also correct, so the bindings should be ok (I've rechecked numerous time, and if I made a mistake I couldn't get a correct display), here's the .woa declaration:
----
ToManyRelationship: WOToManyRelationship {
relationshipKey = "productCategorys";
sourceObject = productGeneric;
sourceEntityName = "ProductGeneric";
uiStyle = "browser";
destinationDisplayKey = "name";
}
----
-When submitting the form (which also save ec), I got the crash...Here's my save method:
----
public WOComponent addOrUpdateProductGeneric()
{
if (!productGenericList.containsObject(productGeneric))
{
productGenericList.addObject(productGeneric);
ec.insertObject(productGeneric);
awakeFromInsertionProductGeneric(ec); // this is to set the date posted
}
else
{
awakeFromInsertionProductGeneric(ec); // this is to set the date last updated
}
productGeneric = new ProductGeneric();
ec.saveChanges();
return context().page();
}
----


I really don't know how to track what's happening...

If anyone could come up with a clue, that would be a real savior.

Thanks

Xavier

PS: As mentioned by Chuck in an answer to Amedeo's problem:
----
This is where the execption happens, last line:
    public void updateSourceObject(NSArray newValues) {

// add new values to relationship, remove old values
Object aSourceObject = _localSourceObject();
boolean isDictionary = (aSourceObject instanceof NSMutableDictionary);
NSMutableDictionary _dictionary = (isDictionary) ? (NSMutableDictionary) aSourceObject : null;
EOEnterpriseObject _eo = (!isDictionary) ? (EOEnterpriseObject) aSourceObject : null;
String masterKey = _localRelationshipKey();
NSMutableArray currentValues = (NSMutableArray) NSKeyValueCoding.Utility.valueForKey(aSourceObject, masterKey);
int count = currentValues.count();


Thus, NSKeyValueCoding.Utility.valueForKey(aSourceObject, masterKey) returns null. In other words, sourceObject.valueForKey (masterKey) returns null. Check the spelling of your bindings. It looks like you have misspelled the tomany relation.

Chuck
----
I've checked all bindings, and I cannot find a mistake. In addition to that, Could I get the WOToMany to display if there were an error?
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40global-village.net


This email sent to email@hidden


--
Practical WebObjects - a book for intermediate WebObjects developers who want to increase their overall knowledge of WebObjects, or those who are trying to solve specific application development problems.
http://www.global-village.net/products/practical_webobjects





_______________________________________________ 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: 
 >Debuging WOManyToManyRelationship (From: Dev WO <email@hidden>)

  • Prev by Date: Re: Debuging WOManyToManyRelationship
  • Next by Date: Re: EOModeler Java source generation
  • Previous by thread: Re: EOModeler Question
  • Next by thread: Tomcat and WO...jars
  • Index(es):
    • Date
    • Thread