• 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
Am I using EOUtilities.createAndInsertInstance() correctly?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Am I using EOUtilities.createAndInsertInstance() correctly?


  • Subject: Am I using EOUtilities.createAndInsertInstance() correctly?
  • From: Des Oates <email@hidden>
  • Date: Mon, 21 Mar 2005 17:21:14 +0000

Apparently not. I'm getting a class cast exception when I call this method like this:

MyObject mo = (MyObject) EOUtilities.createAndInsertInstance(myEC, "MyObject");

Where:

MyObject extends MyGenericObject extends EOGenericRecord

(which extends EOCustomObject which implements EOEnterpriseObject -- The return type of EOUtilities.createAndInsertInstance() )

So, although the inheritance hierarchy is a bit unwieldy, it shouldn't behave like this should it? The code is returning a valid EOEnterpriseObject. I know this since, I modified the code to:

EnterpriseObject eo = EOUtilitiesAndInsertInstance(myEC, "MyObject")
MyObject mo = (MyObject) eo;

Then I still get the ClassCastException, but its thrown on execution of the second line. If I stop the code before executing the cast then I have a valid, populated EOEnterpriseObject in my Eclipse watch window.

So, either I'm missing something embarrassing, there's a bug in this WO code, or I'm not using this utility method as it was intended.

Anybody seen this sort of thing before?

Thanks
Des




 _______________________________________________
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: Am I using EOUtilities.createAndInsertInstance() correctly?
      • From: Christian Pekeler <email@hidden>
    • Re: Am I using EOUtilities.createAndInsertInstance() correctly?
      • From: MacFirst <email@hidden>
  • Prev by Date: Problem with: QualifierOperatorCaseInsensitiveLike
  • Next by Date: Re: Am I using EOUtilities.createAndInsertInstance() correctly?
  • Previous by thread: Trick to implementing NSKeyValueCoding?
  • Next by thread: Re: Am I using EOUtilities.createAndInsertInstance() correctly?
  • Index(es):
    • Date
    • Thread