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
 

Configuring Named Queries at the Session Level

A named query is a TopLink query that you create and store, by name, in a session 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.

If a named query is global to a project, configure it at the session level. Alternatively, you can configure a named query at the descriptor level (see "Configuring Named Queries at the Descriptor Level").

Use named queries to specify SQL, EJB QL, or TopLink Expression queries to access your data source.

Table 77-17 summarizes which sessions support named query configuration.

Table 77-17 Session Support for Named Queries

Session Using TopLink Workbench Using Java

Server and Client Sessions


Unsupported

Supported.


Session Broker and Client Sessions


Unsupported

Supported.


Database Sessions


Unsupported

Supported.



After you create a named query, you can execute it by name on the TopLink session (see "Using Named Queries").

For more information about named queries, see "Named Queries".

Using Java

You can store a query by name in a Session using Session method addQuery(String name, DatabaseQuery query).