Skip Headers
Oracle® Application Development Framework Developer's Guide
10g (10.1.3.1.0)

Part Number B28967-01
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Master Index
Master Index
Go to Feedback page
Contact Us

Go to previous page
Previous
Go to next page
Next
View PDF

3.7 Querying Objects

To query objects, you can create a TopLink Named query then create a data control for the class specified in the query. This will expose the TopLink query to the data control.

A named query is a TopLink query that you create and store for later retrieval and execution. Named queries improve application performance because they are prepared once and they (and all their associated supporting objects) can be efficiently reused thereafter making them well suited for frequently executed operations.

You can create the following queries:

3.7.1 How to Create a Query

You can create TopLink Named Queries by using the TopLink expression builder, SQL expressions, or EJB QL expressions. Using the Mapping editor (see Figure 3-14), you can configure queries at the descriptor- or session-level.

Figure 3-14 Named Queries Tab

welcome screen from Creating Java Objects from Tables wizard

3.7.2 What You May Need to Know

3.7.2.1 Using a Query By Example

A query by example enables you to specify query selection criteria in the form of a sample object instance that you populate with only the attributes you want to use for the query. To define a query by example, provide a ReadObjectQuery or a ReadAllQuery with a sample persistent object instance and an optional query by example policy.

With ADF, a TopLink query by example performs only in-memory querying.

3.7.2.2 Sorting Query Results

You cannot configure the sort criteria of a TopLink query from Oracle JDeveloper. You must write a Java method, using descriptor amendment method. See Section 3.3.3.2, "Using Amendment Methods" for more information.