Loading
Java Persistence API (JPA) Extensions Reference for EclipseLink, Release 2.4
  Go To Table Of Contents
Contents
 Search
Other Searches
 PDF
PDF
Comments
Comments


@QueryRedirectors

Use @QueryRedirectors to intercept EclipseLink queries for pre- and post-processing, redirection, or performing some side effect such as auditing.


Annotation Elements

Table 2-56 describes this annotation's elements.

Table 2-56 @QueryRedirectors Annotation Elements

Annotation Element Description Default

allQueries

This AllQueries Query Redirector will be applied to any executing object query that does not have a more precise redirector (like the ReadObjectQuery Redirector) or a redirector set directly on the query.

void.class

delete

A Default Delete Object Query Redirector will be applied to any executing DeleteObjectQuery or DeleteAllQuery that does not have a redirector set directly on the query.

void.class

insert

A Default Insert Query Redirector will be applied to any executing InsertObjectQuery that does not have a redirector set directly on the query.

void.class

readAll

A Default ReadAll Query Redirector will be applied to any executing ReadAllQuery that does not have a redirector set directly on the query.

For users executing a JPA Query through the getResultList(), API this is the redirector that will be invoked

void.class

readObject

A Default ReadObject Query Redirector will be applied to any executing ReadObjectQuery that does not have a redirector set directly on the query.

For users executing a JPA Query through the getSingleResult() API or EntityManager.find(), this is the redirector that will be invoked

void.class

report

A Default ReportQuery Redirector will be applied to any executing ReportQuery that does not have a redirector set directly on the query.

For users executing a JPA Query that contains aggregate functions or selects multiple entities this is the redirector that will be invoked

void.class

update

A Default Update Query Redirector will be applied to any executing UpdateObjectQuery or UpdateAllQuery that does not have a redirector set directly on the query. In EclipseLink an UpdateObjectQuery is executed whenever flushing changes to the datasource.

void.class



Usage

Use @QueryRedirectors to extend the standard EclipseLink query functionality.

You can set a QueryRedirector through the Query Hint eclipselink.query.redirector or set as a default Redirector on an Entity.

QueryRedirectors are used when integrating EclipseLink Grid to redirect queries to the Coherence grid.


Examples

Example 2-94 shows how to use this annotation.

Example 2-94 Using @QueryRedirectors Annotation

@QueryRedirectors(
    allQueries=org.queryredirectors.AllQueriesForEntity.class)
@Entity
public class
...


See Also

For more information, see:

Comments powered by Disqus