Documentation Archive Developer
Search
PATH  WebObjects 4.5 Documentation > EOAccess Reference

Table of Contents

EOEntity



Creating an Entity

An EOEntity requires at least the following to be usable:

Note that if an entity has no enterprise object class name, the database-level objects use EOGenericRecord.

This code excerpt gives an example of creating an EOEntity and adding it to an EOModel:

EOModel *myModel;          /* Assume this exists. */
NSArray *keyAttributes;    /* Assume this exists. */
EOEntity *employeeEntity;
BOOL result;

employeeEntity = [[[EOEntity alloc] init] autorelease];
[employeeEntity setName:@"employee"];
[employeeEntity setExternalName:@"EMPLOYEE"];
[employeeEntity setClassName:@"Employee"];

/* Create at least the primary key attributes. */
result = [employeeEntity setPrimaryKeyAttributes:keyAttributes];

/* Add the entity to the model. */
[myModel addEntity:employeeEntity];


Table of Contents