To inspect an entity, select the entity in the Model Editor and open the inspector (either with the
Figure 35 shows the Entity Inspector for the Movie entity.
Figure 35. The Entity Inspector
Properties
The Primary Key column is used to declare whether a property is, or is part of, the primary key for the enterprise object class. To specify a compound primary key, you simply add a Primary Key icon to the column for each property you want to include in the primary key.
The Class Property column is used to indicate properties that meet both of these criteria: You want to include them in your class definition, and they can be fetched from the database. By default, the Entity Inspector sets all of an entity's properties as belonging to your class. You can remove a property by clicking its Class Property icon. If you define an attribute that doesn't exist in the database but is used by your application (such as a computed value), you should remove its Class Property icon. Note that generated source files won't include instance variable declarations for these attributes-you'll have to type those in by hand (this is a rare case). You also should not include primary and foreign keys as class properties unless you need to display their values in the user interface. If you don't remove the Class Property icon for an attribute that has no corresponding database value, it will result in a server error when your application attempts to fetch the property from the database.
The Used For Locking column indicates whether an attribute should be checked for changes before an update is allowed. This setting applies when you're using Enterprise Object Framework's default update strategy, optimistic locking. Under optimistic locking, the state of a row is saved as a snapshot when you fetch it from the database. When you perform an update, the snapshot is checked against the row to make sure the row hasn't changed. If you set Used For Locking for an attribute whose data is a BLOB type, it can have an adverse effect on system performance. By default, the Entity Inspector sets all of an entity's attributes to be used for locking.
Table of Contents
Next Section