public final class HermesParser extends java.lang.Object implements JPAQueryBuilder
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.
JPQLExpression
Constructor and Description |
---|
HermesParser()
Creates a new
HermesParser . |
Modifier and Type | Method and Description |
---|---|
DatabaseQuery |
buildQuery(java.lang.CharSequence jpqlQuery,
AbstractSession session)
Creates a fully initialized
DatabaseQuery by parsing the given
JPQL query. |
Expression |
buildSelectionCriteria(java.lang.String entityName,
java.lang.String selectionCriteria,
AbstractSession session)
Creates a new
Expression that represents the given selection
criteria. |
void |
populateQuery(java.lang.CharSequence jpqlQuery,
DatabaseQuery query,
AbstractSession session)
Populates the given
DatabaseQuery by parsing the given JPQL
query. |
void |
setValidationLevel(java.lang.String validationLevel)
Allow the parser validation level to be set.
|
public DatabaseQuery buildQuery(java.lang.CharSequence jpqlQuery, AbstractSession session)
DatabaseQuery
by parsing the given
JPQL query.buildQuery
in interface JPAQueryBuilder
jpqlQuery
- A non-null
string representation of the query to
parse and to convert into a DatabaseQuery
session
- The EclipseLink AbstractSession
that this query will
execute againstDatabaseQuery
public Expression buildSelectionCriteria(java.lang.String entityName, java.lang.String selectionCriteria, AbstractSession session)
Expression
that represents the given selection
criteria.buildSelectionCriteria
in interface JPAQueryBuilder
entityName
- The name of the entity for which a criteria is createdselectionCriteria
- The string representation of a conditional expression to parsesession
- The EclipseLink AbstractSession
that this query will
execute againstExpression
public void populateQuery(java.lang.CharSequence jpqlQuery, DatabaseQuery query, AbstractSession session)
DatabaseQuery
by parsing the given JPQL
query.populateQuery
in interface JPAQueryBuilder
jpqlQuery
- A non-null
string representation of the query to
parse and to convert into a DatabaseQuery
query
- The query to populate with the derived JPQL querysession
- The EclipseLink AbstractSession
that this query will
execute againstpublic void setValidationLevel(java.lang.String validationLevel)
setValidationLevel
in interface JPAQueryBuilder
validationLevel
- The validation levels are defined in ParserValidationTypeEclipseLink 2.6.3, "build v20160428-59c81c5" API Reference