Module org.eclipse.persistence.core
Package org.eclipse.persistence.queries
Interface JPAQueryBuilder
- All Known Implementing Classes:
HermesParser
public interface JPAQueryBuilder
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.
- Since:
- 2.2
- Version:
- 2.4
-
Method Summary
Modifier and TypeMethodDescriptionbuildQuery
(CharSequence jpqlQuery, AbstractSession session) Creates a fully initializedDatabaseQuery
by parsing the given JPQL query.buildSelectionCriteria
(String entityName, String selectionCriteria, AbstractSession session) Creates a newExpression
that represents the given selection criteria.void
populateQuery
(CharSequence jpqlQuery, DatabaseQuery query, AbstractSession session) Populates the givenDatabaseQuery
by parsing the given JPQL query.void
setValidationLevel
(String level) Allow the parser validation level to be set.
-
Method Details
-
setValidationLevel
Allow the parser validation level to be set.- Parameters:
level
- The validation levels are defined in ParserValidationType
-
buildQuery
Creates a fully initializedDatabaseQuery
by parsing the given JPQL query.- Parameters:
jpqlQuery
- A non-null
string representation of the query to parse and to convert into aDatabaseQuery
session
- The EclipseLinkAbstractSession
that this query will execute against- Returns:
- The fully initialized
DatabaseQuery
-
buildSelectionCriteria
Expression buildSelectionCriteria(String entityName, String selectionCriteria, AbstractSession session) Creates a newExpression
that represents the given selection criteria.- Parameters:
entityName
- The name of the entity for which a criteria is createdselectionCriteria
- The string representation of a conditional expression to parsesession
- The EclipseLinkAbstractSession
that this query will execute against- Returns:
- The fully initialized
Expression
-
populateQuery
Populates the givenDatabaseQuery
by parsing the given JPQL query.- Parameters:
jpqlQuery
- A non-null
string representation of the query to parse and to convert into aDatabaseQuery
query
- The query to populate with the derived JPQL querysession
- The EclipseLinkAbstractSession
that this query will execute against
-