Top Description Methods
org.eclipse.persistence.queries

public Interface JPAQueryBuilder

Known Direct Implementers
org.eclipse.persistence.internal.jpa.jpql.HermesParser
Imports
org.eclipse.persistence.expressions.Expression, org.eclipse.persistence.internal.jpa.jpql.HermesParser, org.eclipse.persistence.internal.sessions.AbstractSession

This interface defines the entry point for implementing a JPQL query parsing system in EclipseLink.

By default, EclipseLink uses HermesParser for parsing a query and converting it into a DatabaseQuery.

Third-parties can implement this interface and provide a different JPQL parsing system if required. The JPAQueryBuilder implementing class can be registered via a persistence unit property and the implementation class must have a public, zero-arg constructor.

Authors
John Bracken, Pascal Filion
Since
2.2
Version
2.4

Method Summary

Modifier and TypeMethod and Description
public DatabaseQuery

Returns:

The fully initialized DatabaseQuery
buildQuery
(CharSequence
A non-null string representation of the query to parse and to convert into a DatabaseQuery
jpqlQuery
,
AbstractSession
The EclipseLink AbstractSession that this query will execute against
session
)

Creates a fully initialized DatabaseQuery by parsing the given JPQL query.

public Expression

Returns:

The fully initialized Expression
buildSelectionCriteria
(String
The name of the entity for which a criteria is created
entityName
,
String
The string representation of a conditional expression to parse
selectionCriteria
,
AbstractSession
The EclipseLink AbstractSession that this query will execute against
session
)

Creates a new Expression that represents the given selection criteria.

public void
populateQuery(CharSequence
A non-null string representation of the query to parse and to convert into a DatabaseQuery
jpqlQuery
,
DatabaseQuery
The query to populate with the derived JPQL query
query
,
AbstractSession
The EclipseLink AbstractSession that this query will execute against
session
)

Populates the given DatabaseQuery by parsing the given JPQL query.

public void
setValidationLevel(String
The validation levels are defined in ParserValidationType
level
)

Allow the parser validation level to be set.

Method Detail

buildQueryback to summary
public DatabaseQuery buildQuery(CharSequence jpqlQuery, AbstractSession session)

Creates a fully initialized DatabaseQuery by parsing the given JPQL query.

Parameters
jpqlQuery:CharSequence

A non-null string representation of the query to parse and to convert into a DatabaseQuery

session:AbstractSession

The EclipseLink AbstractSession that this query will execute against

Returns:DatabaseQuery

The fully initialized DatabaseQuery

buildSelectionCriteriaback to summary
public Expression buildSelectionCriteria(String entityName, String selectionCriteria, AbstractSession session)

Creates a new Expression that represents the given selection criteria.

Parameters
entityName:String

The name of the entity for which a criteria is created

selectionCriteria:String

The string representation of a conditional expression to parse

session:AbstractSession

The EclipseLink AbstractSession that this query will execute against

Returns:Expression

The fully initialized Expression

populateQueryback to summary
public void populateQuery(CharSequence jpqlQuery, DatabaseQuery query, AbstractSession session)

Populates the given DatabaseQuery by parsing the given JPQL query.

Parameters
jpqlQuery:CharSequence

A non-null string representation of the query to parse and to convert into a DatabaseQuery

query:DatabaseQuery

The query to populate with the derived JPQL query

session:AbstractSession

The EclipseLink AbstractSession that this query will execute against

setValidationLevelback to summary
public void setValidationLevel(String level)

Allow the parser validation level to be set.

Parameters
level:String

The validation levels are defined in ParserValidationType