EclipseLink1.0 - 20080707 API Reference

org.eclipse.persistence.config
Class QueryHints

java.lang.Object
  extended by org.eclipse.persistence.config.QueryHints

public class QueryHints
extends java.lang.Object

The class defines EclipseLink query hints. These query hints allow a JPA Query to be customized or optimized beyond what is available in the JPA specification.

JPA Query Hint Usage:

query.setHint(QueryHints.CACHE_USAGE, CacheUsage.CheckCacheOnly);

or

@QueryHint(name=QueryHints.CACHE_USAGE, value=CacheUsage.CheckCacheOnly)

Hint values are case-insensitive; "" could be used instead of default value.

See Also:
HintValues, CacheUsage, PessimisticLock, QueryType

Field Summary
static java.lang.String BATCH
          Configures the query to optimize the retrieval of the related objects, the related objects for all the resulting objects will be read in a single query (instead of n queries).
static java.lang.String BIND_PARAMETERS
          Configures parameter binding to be disabled or enabled just for this query (overrides persistent unit setting, which default to true).
static java.lang.String CACHE_USAGE
          Configures the query to utilize the TopLink cache, by default the cache is not checked on queries before accessing the database.
static java.lang.String FETCH
          Configures the query to optimize the retrieval of the related objects, the related objects will be joined into the query instead of being queried independently.
static java.lang.String JDBC_FETCH_SIZE
          Configures the JDBC fetch-size for the queries result-set.
static java.lang.String JDBC_MAX_ROWS
          Configures the JDBC max-rows, if the query returns more rows than the max-rows the trailing rows will not be returned by the database.
static java.lang.String JDBC_TIMEOUT
          Configures the JDBC timeout of the query execution, if the database query exceeds the timeout the database will terminate the query and return an exception.
static java.lang.String PESSIMISTIC_LOCK
          Configures the query to acquire a pessimisitc lock (write-lock) on the resulting rows in the database.
static java.lang.String QUERY_REDIRECTOR
          Used to provide a Query Redirector to the executing query.
static java.lang.String QUERY_TYPE
          Configures the TopLink query type to use for the query.
static java.lang.String READ_ONLY
          Configures the query to return shared (read-only) objects from the cache, instead of objects registered with the persistence context.
static java.lang.String REFRESH
          Configures the query to refresh the resulting objects in the cache and persistent context with the current state of the database.
static java.lang.String REFRESH_CASCADE
          Valid values are all declared in CascadePolicy class.
static java.lang.String RESULT_COLLECTION_TYPE
          Configures the collection class implementation for the queries result.
 
Constructor Summary
QueryHints()
           
 
Method Summary
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BIND_PARAMETERS

public static final java.lang.String BIND_PARAMETERS
Configures parameter binding to be disabled or enabled just for this query (overrides persistent unit setting, which default to true). Valid values are: HintValues.PERSISTENCE_UNIT_DEFAULT, HintValues.TRUE, HintValues.FALSE, "" could be used instead of default value HintValues.PERSISTENCE_UNIT_DEFAULT

See Also:
Constant Field Values

CACHE_USAGE

public static final java.lang.String CACHE_USAGE
Configures the query to utilize the TopLink cache, by default the cache is not checked on queries before accessing the database. Valid values are all declared in CacheUsage class.

See Also:
Constant Field Values

QUERY_REDIRECTOR

public static final java.lang.String QUERY_REDIRECTOR
Used to provide a Query Redirector to the executing query.

See Also:
Constant Field Values

QUERY_TYPE

public static final java.lang.String QUERY_TYPE
Configures the TopLink query type to use for the query. By default TopLink ReportQuery or ReadAllQuery are used for most JPQL queries, this allows other query types to be used, such as ReadObjectQuery which can be used for queries that are know to return a single object, and has different caching semantics. Valid values are all declared in QueryType class.

See Also:
Constant Field Values

PESSIMISTIC_LOCK

public static final java.lang.String PESSIMISTIC_LOCK
Configures the query to acquire a pessimisitc lock (write-lock) on the resulting rows in the database. Valid values are all declared in PessimisticLock class.

See Also:
Constant Field Values

REFRESH

public static final java.lang.String REFRESH
Configures the query to refresh the resulting objects in the cache and persistent context with the current state of the database. Valid values are: HintValues.FALSE, HintValues.TRUE, "" could be used instead of default value HintValues.FALSE

See Also:
Constant Field Values

BATCH

public static final java.lang.String BATCH
Configures the query to optimize the retrieval of the related objects, the related objects for all the resulting objects will be read in a single query (instead of n queries). Valid values are strings that represent JPQL style navigations to a relationship.

e.g. e.manager.phoneNumbers

See Also:
Constant Field Values

FETCH

public static final java.lang.String FETCH
Configures the query to optimize the retrieval of the related objects, the related objects will be joined into the query instead of being queried independently. This allow for nested join fetching which is not supported in JPQL. Valid values are strings that represent JPQL style navigations to a relationship.

e.g. e.manager.phoneNumbers

See Also:
Constant Field Values

READ_ONLY

public static final java.lang.String READ_ONLY
Configures the query to return shared (read-only) objects from the cache, instead of objects registered with the persistence context. This improves performance by avoiding the persistence context registration and change tracking overhead to read-only objects. Valid values are: HintValues.FALSE, HintValues.TRUE, "" could be used instead of default value HintValues.FALSE

See Also:
Constant Field Values

JDBC_TIMEOUT

public static final java.lang.String JDBC_TIMEOUT
Configures the JDBC timeout of the query execution, if the database query exceeds the timeout the database will terminate the query and return an exception. Valid values are Integer or Strings that can be parsed to int values.

See Also:
Constant Field Values

JDBC_FETCH_SIZE

public static final java.lang.String JDBC_FETCH_SIZE
Configures the JDBC fetch-size for the queries result-set. This can improve the performance for queries that return large result-sets. Valid values are Integer or Strings that can be parsed to int values.

See Also:
Constant Field Values

JDBC_MAX_ROWS

public static final java.lang.String JDBC_MAX_ROWS
Configures the JDBC max-rows, if the query returns more rows than the max-rows the trailing rows will not be returned by the database. Valid values are Integer or Strings that can be parsed to int values.

See Also:
Constant Field Values

RESULT_COLLECTION_TYPE

public static final java.lang.String RESULT_COLLECTION_TYPE
Configures the collection class implementation for the queries result. The fully qualified class name must be used, without the .class. * Valid values are a Class representing a collection type or a String representing the classname the colleciton type.

e.g. java.util.ArrayList

See Also:
Constant Field Values

REFRESH_CASCADE

public static final java.lang.String REFRESH_CASCADE
Valid values are all declared in CascadePolicy class.

See Also:
Constant Field Values
Constructor Detail

QueryHints

public QueryHints()

EclipseLink1.0 - 20080707 API Reference