Пример #1
0
  /**
   * Returns the {@link JPQLGrammar} that will help to validate the JPQL query grammatically and
   * semantically (contextually). It will also checks if any specific feature added to that grammar
   * 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.
   *
   * @return The {@link JPQLGrammar} written for a specific JPA version or for the current version
   *     of EclipseLink
   */
  private JPQLGrammar jpqlGrammar() {

    if (validationLevel == ParserValidationType.EclipseLink) {
      return DefaultEclipseLinkJPQLGrammar.instance();
    }

    if (validationLevel == ParserValidationType.JPA10) {
      return JPQLGrammar1_0.instance();
    }

    if (validationLevel == ParserValidationType.JPA20) {
      return JPQLGrammar2_0.instance();
    }

    if (validationLevel == ParserValidationType.JPA21) {
      return JPQLGrammar2_1.instance();
    }

    return DefaultEclipseLinkJPQLGrammar.instance();
  }
 /** {@inheritDoc} */
 public JPQLGrammar getGrammar() {
   return JPQLGrammar2_0.instance();
 }