• 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: creating a new object with a decendant class from EOGenericRecord
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >creating a new object with a decendant class from EOGenericRecord (From: John Spicer <email@hidden>)

  • Prev by Date: creating a new object with a decendant class from EOGenericRecord
  • Next by Date: EOModeler enumeration question
  • Previous by thread: creating a new object with a decendant class from EOGenericRecord
  • Next by thread: Re: creating a new object with a decendant class from EOGenericRecord
  • Index(es):
    • Date
    • Thread