Re: creating a new object with a decendant class from EOGenericRecord
Re: creating a new object with a decendant class from EOGenericRecord
- Subject: Re: creating a new object with a decendant class from EOGenericRecord
- From: "Arturo Perez" <email@hidden>
- Date: Thu, 06 Jan 2005 14:55:58 -0500
John Spicer wrote:
MTSubscriber user = (MTSubscriber) new MTSubscriber();
I didn't think there were no argument constructors for EOs. At a
minimum you need the one that takes an editing context.
I've also tried this but I get a class cast exception at run time (make
sense, since user is declared as MTSubscriber instead of EOGenericRecord):
subscriberDescription =
EOClassDescription.classDescriptionForEntityName("MTSubscriber");
user = (MTSubscriber) new EOGenericRecord (subscriberDescription);
You're missing something here (can't recall off the top of my head).
The method you need for the above is called createAndInsertInstance (I
think) in EOUtilities. Alternatively, instead of a constructor you can
override awakeFromInsert().
_______________________________________________
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