Class HermesParser
- java.lang.Object
-
- org.eclipse.persistence.internal.jpa.jpql.HermesParser
-
- All Implemented Interfaces:
JPAQueryBuilder
public final class HermesParser extends Object implements JPAQueryBuilder
This class compiles a JPQL query into aDatabaseQuery
. 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.
- Since:
- 2.3
- Version:
- 2.5
- Author:
- John Bracken, Pascal Filion
- See Also:
JPQLExpression
-
-
Constructor Summary
Constructors Constructor Description HermesParser()
Creates a newHermesParser
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DatabaseQuery
buildQuery(CharSequence jpqlQuery, AbstractSession session)
Creates a fully initializedDatabaseQuery
by parsing the given JPQL query.Expression
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.
-
-
-
Method Detail
-
buildQuery
public DatabaseQuery buildQuery(CharSequence jpqlQuery, AbstractSession session)
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
public void populateQuery(CharSequence jpqlQuery, DatabaseQuery query, AbstractSession session)
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
public void setValidationLevel(String validationLevel)
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
-
-