Module org.eclipse.persistence.core
Class HermesParser
java.lang.Object
org.eclipse.persistence.internal.jpa.jpql.HermesParser
- All Implemented Interfaces:
JPAQueryBuilder
This class compiles a JPQL query into a
DatabaseQuery
. If validation is not turned off,
then the JPQL query will be validated based on the grammar related to the validation level and
will also be validated based on the semantic (context).
The validation level determines how to validate the JPQL query. It checks if any specific feature is allowed. For instance, if the JPQL query has functions defined for EclipseLink grammar but the validation level is set for generic JPA, then an exception will be thrown indicating the function cannot be used.
- See Also:
-
Constructor Summary
-
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 validationLevel) Allow the parser validation level to be set.
-
Constructor Details
-
HermesParser
public HermesParser()Creates a newHermesParser
.
-
-
Method Details
-
buildQuery
Description copied from interface:JPAQueryBuilder
Creates a fully initializedDatabaseQuery
by parsing the given JPQL query.- Specified by:
buildQuery
in interfaceJPAQueryBuilder
- 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
public Expression buildSelectionCriteria(String entityName, String selectionCriteria, AbstractSession session) Description copied from interface:JPAQueryBuilder
Creates a newExpression
that represents the given selection criteria.- Specified by:
buildSelectionCriteria
in interfaceJPAQueryBuilder
- 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
Description copied from interface:JPAQueryBuilder
Populates the givenDatabaseQuery
by parsing the given JPQL query.- Specified by:
populateQuery
in interfaceJPAQueryBuilder
- 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
-
setValidationLevel
Description copied from interface:JPAQueryBuilder
Allow the parser validation level to be set.- Specified by:
setValidationLevel
in interfaceJPAQueryBuilder
- Parameters:
validationLevel
- The validation levels are defined in ParserValidationType
-