TopLink automatically defines direct query keys for all direct mappings and has a special query key type for each mapping. Typically, use query keys to access fields that do not have direct mappings, such as the version field used for optimistic locking or the type field used for inheritance.
TopLink displays automatically generated queries in the Query Keys tab (see Figure 4-10). You cannot change these keys.
Example 4-3 Automatically Generated Query Key
For example, consider the Employee class in the TopLink tutorial: When you define a direct-to-field mapping from the Employee class (attribute firstName) to the EMPLOYEE table (field F_NAME) you get a query key for free - it is automatically generated.
The following code example illustrates using an automatically generated query key within the TopLink expression framework.
Vector employees = session.readAllObjects(Employee.class, new ExpressionBuilder().get("firstName").equal("Bob"));
Copyright © 1997, 2004, Oracle. All rights reserved.