Am I using EOUtilities.createAndInsertInstance() correctly?
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