Class DefaultSemanticValidator

  • All Implemented Interfaces:
    ExpressionVisitor

    public class DefaultSemanticValidator
    extends AbstractSemanticValidator
    This validator is responsible to gather the problems found in a JPQL query by validating the content to make sure it is semantically valid. The grammar is not validated by this visitor.

    For instance, the function AVG accepts a state field path. The property it represents has to be of numeric type. AVG(e.name) is parsable but is not semantically valid because the type of name is a string (the property signature is: "private String name").

    Provisional API: This interface is part of an interim API that is still under development and expected to change significantly before reaching stability. It is available at this early stage to solicit feedback from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken (repeatedly) as the API evolves.

    Since:
    2.3
    Version:
    2.5
    Author:
    Pascal Filion
    See Also:
    DefaultGrammarValidator
    • Constructor Detail

      • DefaultSemanticValidator

        public DefaultSemanticValidator​(JPQLQueryContext queryContext)
        Creates a new DefaultSemanticValidator.
        Parameters:
        queryContext - The context used to query information about the JPQL query
        Throws:
        java.lang.NullPointerException - The given JPQLQueryContext cannot be null
      • DefaultSemanticValidator

        public DefaultSemanticValidator​(SemanticValidatorHelper helper)
        Creates a new DefaultSemanticValidator.
        Parameters:
        helper - The given helper allows the validator to access the JPA artifacts without using Hermes SPI directly
        Throws:
        java.lang.NullPointerException - The given SemanticValidatorHelper cannot be null
        Since:
        2.4