Module org.eclipse.persistence.core
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.
- 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 DatabaseQuerybuildQuery(CharSequence jpqlQuery, AbstractSession session)Creates a fully initializedDatabaseQueryby parsing the given JPQL query.ExpressionbuildSelectionCriteria(String entityName, String selectionCriteria, AbstractSession session)Creates a newExpressionthat represents the given selection criteria.voidpopulateQuery(CharSequence jpqlQuery, DatabaseQuery query, AbstractSession session)Populates the givenDatabaseQueryby parsing the given JPQL query.voidsetValidationLevel(String validationLevel)Allow the parser validation level to be set.
-
-
-
Method Detail
-
buildQuery
public DatabaseQuery buildQuery(CharSequence jpqlQuery, AbstractSession session)
Description copied from interface:JPAQueryBuilderCreates a fully initializedDatabaseQueryby parsing the given JPQL query.- Specified by:
buildQueryin interfaceJPAQueryBuilder- Parameters:
jpqlQuery- A non-nullstring representation of the query to parse and to convert into aDatabaseQuerysession- The EclipseLinkAbstractSessionthat this query will execute against- Returns:
- The fully initialized
DatabaseQuery
-
buildSelectionCriteria
public Expression buildSelectionCriteria(String entityName, String selectionCriteria, AbstractSession session)
Description copied from interface:JPAQueryBuilderCreates a newExpressionthat represents the given selection criteria.- Specified by:
buildSelectionCriteriain interfaceJPAQueryBuilder- Parameters:
entityName- The name of the entity for which a criteria is createdselectionCriteria- The string representation of a conditional expression to parsesession- The EclipseLinkAbstractSessionthat this query will execute against- Returns:
- The fully initialized
Expression
-
populateQuery
public void populateQuery(CharSequence jpqlQuery, DatabaseQuery query, AbstractSession session)
Description copied from interface:JPAQueryBuilderPopulates the givenDatabaseQueryby parsing the given JPQL query.- Specified by:
populateQueryin interfaceJPAQueryBuilder- Parameters:
jpqlQuery- A non-nullstring representation of the query to parse and to convert into aDatabaseQueryquery- The query to populate with the derived JPQL querysession- The EclipseLinkAbstractSessionthat this query will execute against
-
setValidationLevel
public void setValidationLevel(String validationLevel)
Description copied from interface:JPAQueryBuilderAllow the parser validation level to be set.- Specified by:
setValidationLevelin interfaceJPAQueryBuilder- Parameters:
validationLevel- The validation levels are defined in ParserValidationType
-
-