Annotation Interface CheckHQL


@Target({PACKAGE,TYPE}) @Retention(CLASS) @Incubating public @interface CheckHQL
Indicates that a package or top-level type contains HQL or JPQL queries encoded as static strings that should be validated at compile time by the Metamodel Generator or Query Validator. Errors in queries are reported by the Java compiler.

The Metamodel Generator or Query Validator must be enabled as an annotation processor in the project build. Otherwise, if neither is enabled, this annotation has no effect.

If only the Metamodel Generator is enabled, only arguments to the following annotations are validated:

Otherwise, if the Query validator is enabled, then, within the scope annotated @CheckHQL, any static string argument to any one of the following methods is interpreted as HQL/JPQL and validated:

The entity classes referred to by the queries must be annotated with basic JPA metadata annotations like @Entity, @ManyToOne, @Embeddable, @MappedSuperclass, @ElementCollection, and @Access. Metadata specified in XML mapping documents is ignored by the query validator.

Syntax errors, unknown entity names and unknown entity member names, and typing errors all result in compile-time errors.

Since:
6.3
Author:
Gavin King
See Also:
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    Class<? extends Dialect>
    A Hibernate dialect to use.
  • Element Details

    • dialect

      Class<? extends Dialect> dialect
      A Hibernate dialect to use.
      See Also:
      Default:
      org.hibernate.annotations.processing.GenericDialect.class