Package jakarta.persistence
Annotation Type 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. TheNamedNativeQueryannotation can be applied to an entity or mapped superclass.- Since:
 - 1.0
 
 
- 
- 
Required Element Summary
Required Elements Modifier and Type Required Element Description StringnameThe name used to refer to the query with theEntityManagermethods that create query objects.StringqueryThe SQL query string. 
- 
Optional Element Summary
Optional Elements Modifier and Type Optional Element Description QueryHint[]hintsQuery properties and hints.ClassresultClassThe class of the result.StringresultSetMappingThe name of aSqlResultSetMapping, as defined in metadata. 
 - 
 
- 
- 
Element Detail
- 
name
String name
The name used to refer to the query with theEntityManagermethods 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 aSqlResultSetMapping, as defined in metadata.- Default:
 - ""
 
 
 - 
 
 -