Hi all,
I've run into something that _seems_ to work, but just seems "wrong"
and I don't see how to do it "right".
I have the following inheritance structure in my model:
LotCode (NOT abstract)
ManufacturedBatch extends LotCode.
When I call awakeFromInsertion on the superclass I do it as follows :
public void awakeFromInsertion(EOEditingContext ec) {
super.awakeFromInsertion(ec);
if (lotCodeType() == null) {
setLotCodeType(1);
}
}
But when I call awakeFromInsertion on the subclass I have to do this:
public void awakeFromInsertion(EOEditingContext ec) {
super.awakeFromInsertion(ec);
if (lotCodeType() == null || lotCodeType.equals(1)) {
setLotCodeType(1);
}
}
I know that you should _never_ change the class of an EO after
creating it, but that's exactly what I'm doing here. When
awakeFromInsertion is called on the subclass, the first thing it does
is call super.awakeFromInsertion, which sets the class to LotCode, but
then I change it to a ManufacturedBatch immediately after.
If I don't do this, a call of ManufacturedBatch newManufacturedBatch =
new ManufacturedBatch() returns a LotCode instead.
So, is this an exception to the rule "never change an EO's class" or
is it because I'm doing it in the awakeFromInsertion process that it
is okay?
Or is it wrong to do this and I just haven't been bitten by it yet?
Dave
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com
This email sent to [EMAIL PROTECTED]