Am 18.05.2006 23:06 Uhr schrieb "David Avendasora" unter
<[EMAIL PROTECTED]>:

> You see, I knew I was missing something obvious. And here I was
> trying to override the setter for the relationship. Nothing like
> trying to do it the hard way.
And after all this good tips, you might think about factory methods for each
class like this:

public static MyClass newMyClassForYourRelatedEOs ( EOEditingContext ec,
MultipleParameter myRelatedEOs )
    {
        MyClass newObject = new MyClass ( ec );
        // set your initial relationships
        newObject.addObjectToBothSidesOfRelationshipWithKey ( myRelatedEO1,
"myRelation1" );
        newObject.addObjectToBothSidesOfRelationshipWithKey ( myRelatedEO2,
"myRelation2" );
        //
        return newObject;
    }


The final setup can follow  here:

    public void awakeFromInsertion ( EOEditingContext ec )
    {
        super.awakeFromInsertion ( ec );
// set your initial values
    }


Validating might be a nice idea too:

    public void validateForSave () throws NSValidation.ValidationException
    {
// do your validation first (i prefer this, because super.validateForSave
returns always english error messages, so i try to validate before super and
display my own colloquial)
        super.validateForSave ();
// or do your validation last for all remaining errors
    }

HTH

Wolfram


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to archive@mail-archive.com

Reply via email to