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

Re: ClassCastException???


  • Subject: Re: ClassCastException???
  • From: Awbrey Hughlett <email@hidden>
  • Date: Thu, 2 Oct 2008 11:37:29 -0500

The Basic and Specific EOs are linked to WOPopUpButtons. I want the selection value (bound to aBasic and aSpecific) to be added to the new instance of a Listing EO. I figured I didn't want a new object on both sides of the relationship since aBasic and aSpecific already have values set by the WOPopUpButton. That is why I went with listing ().addObjectToPropertyWithKey(aSpecific, "specific"). Is my understanding of this wrong?

Awbrey
On Oct 2, 2008, at 11:27 AM, Johann Werner wrote:

Hi Awbrey,

I suppose the Listing, Basic and Specific are all EOs? Then you can't create new objects of them by just instantiating them the java way. You have to tell WO to create them by using

EOUtilities.createAndInsertInstance(EOEditingContext ec, String entityName)

This inserts a new object of entityName into a specific editing context which you can save at a later stage.

jw

Am 02.10.2008 um 18:04 schrieb Awbrey Hughlett:

I am getting a classCastException from this when I invoke saveChanges(). What am I doing wrong again?

public class DataEntry extends WOComponent {
	private Listing listing = new Listing();
	private Basic basic = new Basic();
	private Specific specific = new Specific();
	private ERXEC ec = new ERXEC();
	public Basic aBasic = new Basic();
	public Specific aSpecific = new Specific();

    public DataEntry(WOContext context) {
        super(context);

        ec.insertObject(listing);
        ec.insertObject(basic);
        ec.insertObject(specific);
    }

    public ERXEC editingContext() {
    	return ec;
    }

public Listing listing() {
if (listing == null) {
ec.revert();

listing = (Listing)EOUtilities.createAndInsertInstance(ec, "Listing");
}

return listing;
}


    public NSArray allSpecificTypes() {
    	return EOUtilities.objectsForEntityNamed(ec, "Specific");
    }

    public NSArray allBasicTypes() {
    	return EOUtilities.objectsForEntityNamed(ec, "Basic");
    }

    public WOComponent saveChanges() {

    	listing().setLastModified(new NSTimestamp());
    	listing().setUserId(1);
    	listing().addObjectToPropertyWithKey(aSpecific, "specific");
    	listing().addObjectToPropertyWithKey(aBasic, "basics");

    	ec.saveChanges();

    	setBasic(null);
    	setSpecific(null);
    	setListing(null);
    	return context().page();
    }

    public void setListing(Listing newListing) {
    	listing = newListing;
    }

    public Basic basicListing() {
    	return basic;
    }

    public Specific specificListing() {
    	return specific;
    }

    public void setBasic(Basic newBasic) {
    	basic = newBasic;
    }

    public void setSpecific(Specific newSpecific) {
    	specific = newSpecific;
    }
}

this is the first part of the stack trace for this error: java.lang.ClassCastException: com.webobjects.foundation.NSMutableArray

_Listing.java
231
specific
com.findthemlistings.eo
NativeMethodAccessorImpl.java
NA
invoke0
sun.reflect
NativeMethodAccessorImpl.java
39
invoke
sun.reflect
DelegatingMethodAccessorImpl.java
25
invoke
sun.reflect
Method.java
585
invoke
java.lang.reflect
NSKeyValueCoding.java
684
methodValue
com.webobjects.foundation
NSKeyValueCoding.java
1160
valueInObject
com.webobjects.foundation
EOCustomObject.java
1559
valueForKey
com.webobjects.eocontrol
EOCustomObject.java
774
eoDescription
com.webobjects.eocontrol
EOCustomObject.java
239
toString
com.webobjects.eocontrol
NSArray.java
920
toString
com.webobjects.foundation
String.java
2615
valueOf
java.lang
StringBuilder.java
116
append
java.lang
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40isd.uni-stuttgart.de


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: This email sent to email@hidden
  • Follow-Ups:
    • Re: ClassCastException???
      • From: Guido Neitzer <email@hidden>
References: 
 >Relationships (From: Awbrey Hughlett <email@hidden>)
 >Re: Relationships (From: Chuck Hill <email@hidden>)
 >ClassCastException??? (From: Awbrey Hughlett <email@hidden>)
 >Re: ClassCastException??? (From: Johann Werner <email@hidden>)

  • Prev by Date: Re: ClassCastException???
  • Next by Date: Re: ClassCastException???
  • Previous by thread: Re: ClassCastException???
  • Next by thread: Re: ClassCastException???
  • Index(es):
    • Date
    • Thread