Class HermesParser

  • All Implemented Interfaces:
    JPAQueryBuilder

    public final class HermesParser
    extends java.lang.Object
    implements 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.

    Since:
    2.3
    Version:
    2.5
    Author:
    John Bracken, Pascal Filion
    See Also:
    JPQLExpression
    • Constructor Detail

      • HermesParser

        public HermesParser()
        Creates a new HermesParser.
    • Method Detail

      • buildSelectionCriteria

        public Expression buildSelectionCriteria​(java.lang.String entityName,
                                                 java.lang.String selectionCriteria,
                                                 AbstractSession session)
        Creates a new Expression that represents the given selection criteria.
        Specified by:
        buildSelectionCriteria in interface JPAQueryBuilder
        Parameters:
        entityName - The name of the entity for which a criteria is created
        selectionCriteria - The string representation of a conditional expression to parse
        session - The EclipseLink AbstractSession that this query will execute against
        Returns:
        The fully initialized Expression
      • populateQuery

        public void populateQuery​(java.lang.CharSequence jpqlQuery,
                                  DatabaseQuery query,
                                  AbstractSession session)
        Populates the given DatabaseQuery by parsing the given JPQL query.
        Specified by:
        populateQuery in interface JPAQueryBuilder
        Parameters:
        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 query
        session - The EclipseLink AbstractSession that this query will execute against
      • setValidationLevel

        public void setValidationLevel​(java.lang.String validationLevel)
        Allow the parser validation level to be set.
        Specified by:
        setValidationLevel in interface JPAQueryBuilder
        Parameters:
        validationLevel - The validation levels are defined in ParserValidationType