Package jakarta.persistence
Annotation Interface NamedNativeQuery
@Repeatable(NamedNativeQueries.class)
@Target(TYPE)
@Retention(RUNTIME)
public @interface NamedNativeQuery
Specifies a named 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
-
Required Element Summary
Modifier and TypeRequired ElementDescriptionThe name used to refer to the query with theEntityManager
methods that create query objects.The SQL query string. -
Optional Element Summary
Modifier and TypeOptional ElementDescriptionQuery properties and hints.The class of the result.The name of aSqlResultSetMapping
, as defined in metadata.
-
Element Details
-
name
String nameThe name used to refer to the query with theEntityManager
methods that create query objects. -
query
String queryThe SQL query string.
-
-
-
hints
QueryHint[] hintsQuery properties and hints. (May include vendor-specific query hints.)- Default:
- {}
-
resultClass
Class resultClassThe class of the result.- Default:
- void.class
-
resultSetMapping
String resultSetMappingThe name of aSqlResultSetMapping
, as defined in metadata.- Default:
- ""
-