First page Back Continue Last page Text

oracle adf workshop


Using Alternate Key Entity Constraints

Alternate keys are first class key citizens in ADF BC, and are stored in a hashmap for fast access. They are useful for:

Efficient uniqueness checks in the middle tier via the Unique Key validator

Direct row lookups via the findByKey() class of methods

They differ from:

Primary keys in that it is possible to define any number of multipart alternate keys

Unique keys in that those are used primarily for forward generation of UNIQUE constraints in the database

For example, if you want to be able to locate a Department entity instance based either on the unique DepartmentId (primary key) or the DepartmentName, you can define an alternate key for the DepartmentName attribute. You can then use this named alternate key in the new findByAltKey() entity object API, or you can reference it in a Unique Key validator to automatically enforce that two departments cannot have the same DepartmentName value.