Class EclipseLinkSemanticValidator

  • All Implemented Interfaces:
    EclipseLinkExpressionVisitor, ExpressionVisitor

    public class EclipseLinkSemanticValidator
    extends AbstractEclipseLinkSemanticValidator
    This validator is responsible to gather the problems found in a JPQL query by validating the content to make sure it is semantically valid for EclipseLink. 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").

    Note: EclipseLink does not validate types, but leaves it to the database. This is because some databases such as Oracle allow different types to different functions and perform implicit type conversion. i.e. CONCAT('test', 2) returns 'test2'. Also the FUNC function has an unknown type, so should be allowed with any function.

    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.

    Version:
    2.5
    See Also:
    EclipseLinkGrammarValidator
    Author:
    Pascal Filion
    Since:
    2.4
    • Constructor Detail

      • EclipseLinkSemanticValidator

        public EclipseLinkSemanticValidator​(JPQLQueryContext queryContext,
                                            EclipseLinkSemanticValidatorExtension extension)
        Creates a new EclipseLinkSemanticValidator.
        Parameters:
        queryContext - The context used to query information about the JPQL query
        extension - The following extension can be used to give access to non-JPA metadata artifacts, such as database tables and columns
        Throws:
        java.lang.NullPointerException - The given JPQLQueryContext cannot be null
      • EclipseLinkSemanticValidator

        public EclipseLinkSemanticValidator​(SemanticValidatorHelper helper,
                                            EclipseLinkSemanticValidatorExtension extension)
        Creates a new EclipseLinkSemanticValidator.
        Parameters:
        helper - The given helper allows this validator to access the JPA artifacts without using Hermes SPI
        extension - The following extension can be used to give access to non-JPA metadata artifacts, such as database tables and columns
        Throws:
        java.lang.NullPointerException - The given SemanticValidatorHelper cannot be null