Documentation Archive Developer
Search
PATH  Documentation > WebObjects 4.5 > Getting Started With WebObjects


   

Providing Default Values in MovieRole

As discussed in Specifying Default Values for New Enterprise Objects , there are two main ways to specify default values for new enterprise objects without making explicit assignments:

For the Movie class, you specified default values using a display group. This approach is also the more appropriate choice for the MovieRole class, but you'll use the other approach for MovieRole just to see how its done.

  1. Open MovieRole.java in Project Builder.

  2. Add the method, awakeFromInsertion, as follows

    public void awakeFromInsertion(EOEditingContext context){
       super.awakeFromInsertion(context);
       setRoleName("New Role");
    }

    This method is automatically invoked right after your enterprise object class creates a new MovieRole and inserts it into an editing context, which happens when you use a display group to insert.


© 1999 Apple Computer, Inc. – (Last Updated 24 Aug 99)