Annotation Interface NamedNativeQuery


@Repeatable(NamedNativeQueries.class) @Target(TYPE) @Retention(RUNTIME) public @interface NamedNativeQuery
Declares a named native SQL query and, optionally, the mapping of the result of the native SQL query. Query names are scoped to the persistence unit. The NamedNativeQuery annotation can be applied to an entity or mapped superclass.
Since:
1.0
See Also:
  • Element Details

    • name

      String name
      The name used to refer to the query with the EntityManager methods that create query objects.
    • query

      String query
      The SQL query string.
    • hints

      QueryHint[] hints
      Query properties and hints. (May include vendor-specific query hints.)
      Default:
      {}
    • resultClass

      Class<?> resultClass
      The class of the result.
      Default:
      void.class
    • resultSetMapping

      String resultSetMapping
      The name of a SqlResultSetMapping, as defined in metadata.
      Default:
      ""
    • entities

      EntityResult[] entities
      Specifies the result set mapping to entities. May not be used in combination with resultSetMapping().
      Since:
      3.2
      Default:
      {}
    • classes

      Specifies the result set mapping to constructors. May not be used in combination with resultSetMapping().
      Since:
      3.2
      Default:
      {}
    • columns

      ColumnResult[] columns
      Specifies the result set mapping to scalar values. May not be used in combination with resultSetMapping().
      Since:
      3.2
      Default:
      {}