Skip Headers
Oracle TopLink Developer's Guide
10g Release 3 (10.1.3)
B13593-01
  Go To Documentation Library
Home
Go To Product List
Solution Area
Go To Table Of Contents
Contents
Go To Index
Index

Previous
Previous
Next
Next
 

Appending Additional Join Expressions

You can set the query manager to automatically append an expression to every query it performs on a class. For example, you can add an expression that filters the database for the valid instances of a given class.

Use this to do the following:

Using Java

Using Java, configure a descriptor with additional join expressions by creating an amendment method (see "Configuring Amendment Methods"), and then using the DescriptorQueryManager methods setAdditionalJoinExpression or setMultipleTableJoinExpression, as Example 99-6 shows.

Example 99-6 Registering a Query That Includes a Join Expression

In Example 99-6, the join expression filters invalid instances of employee from the query.

public static void addToDescriptor(Descriptor descriptor)
{
    ExpressionBuilder builder = new ExpressionBuilder();
    descriptor.getQueryManager().setAdditionalJoinExpression(
        (builder.getField("EMP.STATUS").notEqual("DELETED")).and(
             builder.getField("EMP.STATUS").notEqual("HISTORICAL"))
    );
}