When an attribute is marked as a class property, Java classes generated by EOModeler contain accessor methods for that attribute. (However, these Java classes do not contain instance variables for those attributes since the instance data is accessed by the mechanism of key-value coding.) You should mark as class properties only those attributes that are useful in your business logic. This reduces the amount of code to maintain and makes your enterprise object classes more readable.
Primary keys and foreign keys should not be marked as class properties. This is for two reasons: Enterprise objects have no knowledge of the primary and foreign keys of the tables from which they are mapped, and these keys are of no use to your business logic. Also, to ensure that the automatic primary key generation feature of Enterprise Objects is properly invoked, primary keys must not be marked as class properties.
In the process of building enterprise objects, if you find
that you need access to primary or foreign keys, there are utility
classes and methods that allow you to access these keys even when
they are not marked as class properties. See the API reference in
the com.webobjects.eoaccess
package
for EOEntity.primaryKeyAttributes
and EOEntity.primaryKeyForGlobalID
,
as well as the API reference for com.webobjects.eocontrol.EOClassDescription
.