• 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: Classcastexception _EOCheapMutableArray Solved
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Classcastexception _EOCheapMutableArray Solved


  • Subject: Re: Classcastexception _EOCheapMutableArray Solved
  • From: Don Lindsay <email@hidden>
  • Date: Tue, 11 Dec 2007 11:48:43 -0500

Hello;

I was able to resolve this by flattening the relationship. Actually I totally rebuilt my EO Model and allowed EoModeler to join the many to many tables. This took care of the problem.

Thanks everyone for all your help.

Don
On Dec 10, 2007, at 1:03 PM, Chuck Hill wrote:


On Dec 9, 2007, at 10:45 AM, Don Lindsay wrote:

Hello;

When I use the following settings I can save and the listbox shows the correct number of rows and the correct selected items.

ToManyRelationship: WOToManyRelationship {
        sourceEntityName = "Agents";
	destinationDisplayKey = "orgs";
	sourceObject = agent;
	relationshipKey = "mgtOfc";
}

However it is a cominbation of all fields in the orgs entity that are being displayed separated by commas and surrounded by curly braces. So I set destinationDisplayKey to orgs.description to get a more user friendly view. I get an error that com.webobjects.foundation.NSKeyValueCoding$UnknownKeyException: valueForKey(): lookup of unknown key: 'orgs.description'. This class does not have an instance variable of the name orgs.description or _orgs.description, nor a method of the name orgs.description, _orgs.description, getOrgs.description, or _getOrgs.description.

That would be a keypath _on_ the destination "orgs". So just destinationDisplayKey = "description";


Chuck

Description is indeed a attribute of orgs and it is in the correct case of description. So I thought I can just override the userPresentableDescription and that should solve the problem. When I do this and compile the listing shows up with <java.lang.class: fault....>. So I looked up the documentation on the EOGenericRecord. I overrode the EODescription and now the information displays correctly in the listing.


Thanks,

Don



On Dec 9, 2007, at 11:51 AM, Don Lindsay wrote:

Hello;

Here is the Agents entity java code:

import com.webobjects.foundation.*;
import com.webobjects.eocontrol.*;
import java.math.BigDecimal;
import java.util.*;
import com.webobjects.examples.utilities.*;

public class Agents extends EOGenericRecord {

    public Agents() {
        super();
    }

/*
// If you implement the following constructor EOF will use it to
// create your objects, otherwise it will use the default
// constructor. For maximum performance, you should only
// implement this constructor if you depend on the arguments.
public Agents(EOEditingContext context, EOClassDescription classDesc, EOGlobalID gid) {
super(context, classDesc, gid);
}


// If you add instance variables to store property values you
// should add empty implementions of the Serialization methods
// to avoid unnecessary overhead (the properties will be
// serialized for you in the superclass).
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
}


private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException {
}
*/


	public String fullNameReverse() {
		return ((Person)person()).fullNameReverse();
	}

	public String personOrganizationRO() {
		return ((Person)person()).organization();
	}

	public String personOrganizationDivision() {
		return ((Person)person()).division();
	}

	public String personOrganizationDirectorate() {
		return ((Person)person()).directorate();
	}

    public Number trainer() {
        return (Number)storedValueForKey("trainer");
    }

    public void setTrainer(Number value) {
        takeStoredValueForKey(value, "trainer");
    }

    public Number custodian() {
        return (Number)storedValueForKey("custodian");
    }

    public void setCustodian(Number value) {
        takeStoredValueForKey(value, "custodian");
    }

    public Number personIdentifier() {
        return (Number)storedValueForKey("personIdentifier");
    }

    public void setPersonIdentifier(Number value) {
        takeStoredValueForKey(value, "personIdentifier");
    }

    public Person person() {
        return (Person)storedValueForKey("person");
    }

    public void setPerson(Person value) {
        takeStoredValueForKey(value, "person");
    }

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

    public void setMgtOfc(NSArray value) {
        takeStoredValueForKey(value, "mgtOfc");
    }

    public void addToMgtOfc(ManagedOrgAssoc object) {
        includeObjectIntoPropertyWithKey(object, "mgtOfc");
    }

    public void removeFromMgtOfc(ManagedOrgAssoc object) {
        excludeObjectFromPropertyWithKey(object, "mgtOfc");
    }

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

    public void setShipRecs(NSArray value) {
        takeStoredValueForKey(value, "shipRecs");
    }

    public void addToShipRecs(ShippingRecords object) {
        includeObjectIntoPropertyWithKey(object, "shipRecs");
    }

    public void removeFromShipRecs(ShippingRecords object) {
        excludeObjectFromPropertyWithKey(object, "shipRecs");
    }

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

    public void setTrngRecs(NSArray value) {
        takeStoredValueForKey(value, "trngRecs");
    }

    public void addToTrngRecs(TrainingRecords object) {
        includeObjectIntoPropertyWithKey(object, "trngRecs");
    }

    public void removeFromTrngRecs(TrainingRecords object) {
        excludeObjectFromPropertyWithKey(object, "trngRecs");
    }

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

    public void setWeapAssigns(NSArray value) {
        takeStoredValueForKey(value, "weapAssigns");
    }

    public void addToWeapAssigns(WeaponAssignment object) {
        includeObjectIntoPropertyWithKey(object, "weapAssigns");
    }

    public void removeFromWeapAssigns(WeaponAssignment object) {
        excludeObjectFromPropertyWithKey(object, "weapAssigns");
    }

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

    public void setTrngOrgs(NSArray value) {
        takeStoredValueForKey(value, "trngOrgs");
    }

    public void addToTrngOrgs(TrainingOrgAssoc object) {
        includeObjectIntoPropertyWithKey(object, "trngOrgs");
    }

    public void removeFromTrngOrgs(TrainingOrgAssoc object) {
        excludeObjectFromPropertyWithKey(object, "trngOrgs");
    }

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

    public void setQualDtes(NSArray value) {
        takeStoredValueForKey(value, "qualDtes");
    }

    public void addToQualDtes(QualDates object) {
        includeObjectIntoPropertyWithKey(object, "qualDtes");
    }

    public void removeFromQualDtes(QualDates object) {
        excludeObjectFromPropertyWithKey(object, "qualDtes");
    }

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

    public void setLostStlnDests(NSArray value) {
        takeStoredValueForKey(value, "lostStlnDests");
    }

    public void addToLostStlnDests(LostStolenDestroyed object) {
        includeObjectIntoPropertyWithKey(object, "lostStlnDests");
    }

public void removeFromLostStlnDests(LostStolenDestroyed object) {
excludeObjectFromPropertyWithKey(object, "lostStlnDests");
}


public boolean isCustodian() {
try {
return (((Number)storedValueForKey("custodian")).intValue()==1);
} catch (Exception e) {
return false;
}
}

public void setIsCustodian(boolean bValue) {
WXDebug.println(10, "Custodian Set :"+(bValue?"1":"0"));
takeStoredValueForKey((bValue?new Integer(1):new Integer (0)), "custodian");
}

public boolean isTrainer() {
try {
return (((Number)storedValueForKey("trainer")).intValue()==1);
} catch (Exception e) {
return false;
}
}

public void setIsTrainer(boolean bValue) {
WXDebug.println(10, "Trainer Set :"+(bValue?"1":"0"));
takeStoredValueForKey((bValue?new Integer(1):new Integer (0)), "trainer");
}
}


Thanks,

Don
On Dec 9, 2007, at 4:44 AM, Lachlan Deck wrote:

Hi Don,

On 09/12/2007, at 7:44 PM, Don Lindsay wrote:

Agents is a single row.

Yes, but is the signature of the method referred to by the key 'agent' returning an NSArray or Agent?


i.e., is it:
public NSArray agent() {...} // wrong
or
public Agent agent() {...} // correct

Just to clarify, can you paste in the code from your java component?

mgtOfc is a relationship key.  Even when I do:

sourceObject:  agent
sourceEntityName: "agents"

That's an unusual entity name. i.e., any entity name (normally) starts with an uppercase char (like your Java classes). e.g., "Agent". (the external name for the entity can be lowercase of course and can be a completely different name if need be).


relationshipKey: "mgtOfc"
destinationDisplayKey = "orgs.name"

The listbox does not show on the screen when the screen is rendered in the application.

Sorry for being so dense.

No worries... we'll get there. We just need to clarify exactly what you're doing.


On Dec 8, 2007, at 10:29 PM, Lachlan Deck wrote:

On 09/12/2007, at 12:16 PM, Don Lindsay wrote:

I want to use a WOToManyRelationship control.

I put in the following
datasource:
sourceObject: 		agents
sourceEntityName: 	"Agents"
relationshipkey: 		"mgtOfc"

sourceObject should be bound to a key that returns an EOEnterpriseObject not an array of objects.


is "mgt0fc" a toMany relationship?

When I do this the wo relationship does not even display in the form.

I put in the following
datasource:
sourceObject:		agents.mgtOfc

Again, if "agents" is an array, then agents.mgtOfc is going to return an array containing the results of performing mgt0fc on each agent in agents. If agents is badly named and does indeed return an EOEnterpriseObject (and not one within an array) then agents.mgt0fc looks like it would be an array rather than a single object.


You should have something like:
sourceObject = myAgent;
sourceEntityName = "Agent";
relationshipKey = managedOrgAssociations;
destinationDisplayKey = "organization.name";

Check out the api for WOJExtensions:
developer.apple.com/documentation/WebObjects/Reference/ WOJExtensions/index.html

with regards, --

Lachlan Deck



_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40mac.com


This email sent to 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:
40mac.com


This email sent to 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:
40global-village.net


This email sent to email@hidden

--

Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific 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: 
 >Classcastexception _EOCheapMutableArray (From: Don Lindsay <email@hidden>)
 >Re: Classcastexception _EOCheapMutableArray (From: Chuck Hill <email@hidden>)
 >Re: Classcastexception _EOCheapMutableArray (From: Don Lindsay <email@hidden>)
 >Re: Classcastexception _EOCheapMutableArray (From: Don Lindsay <email@hidden>)
 >Re: Classcastexception _EOCheapMutableArray (From: Don Lindsay <email@hidden>)
 >Re: Classcastexception _EOCheapMutableArray (From: Lachlan Deck <email@hidden>)
 >Re: Classcastexception _EOCheapMutableArray (From: Don Lindsay <email@hidden>)
 >Re: Classcastexception _EOCheapMutableArray (From: Lachlan Deck <email@hidden>)
 >Re: Classcastexception _EOCheapMutableArray (From: Don Lindsay <email@hidden>)
 >Re: Classcastexception _EOCheapMutableArray Solved (From: Don Lindsay <email@hidden>)
 >Re: Classcastexception _EOCheapMutableArray Solved (From: Chuck Hill <email@hidden>)

  • Prev by Date: Re: wolips / webobjects build question
  • Next by Date: New WOPopUpButton noSelectionString behavior
  • Previous by thread: Re: Classcastexception _EOCheapMutableArray Solved
  • Next by thread: Re: Classcastexception _EOCheapMutableArray
  • Index(es):
    • Date
    • Thread