This annotation specifies a named query in the SQL. This annotation can be applied to an entity class and mapped superclass.
The applicable target is class.
The following table lists the elements of @NamedNativeQuery:
Element name | Optional/Required | Element description |
---|
name | Required | This element specifies the name of the named query. |
query | Required | This element specifies the SQL string. |
hints | Optional | This element specifies an array of @QueryHint. |
resultClass | Optional | This element specifies the class in which the SQL results are applied. |
resultSetMapping | Optional | This element specifies the name indicated in the name element of @SqlResultSetMapping. |
The details of attributes that are supported with Cosminexus JPA provider are as follows:
(a) name element
- Type
- String
- Description
- This element specifies the name of the named query.
- The value that can be specified is a character string.
- Default value
- None
(b) query element
- Type
- String
- Description
- This element specifies the SQL string.
- The SQL that can be specified depends on the specifications of the database used.
- Default value
- None
(c) hints element
- Type
- QueryHint[]
- Description
- This element specifies an array of @QueryHint.
- You can specify the value within the specifiable range of the arrays of @QueryHint. For details, see 2.7.53 @QueryHint.
- Default value
- Blank array
(d) resultClass element
- Type
- Class
- Description
- This element specifies the class in which the SQL results are applied.
- The resultClass element is specified when the class, in which you want to map the execution results of the query, exists. Do not specify the resultClass element and resultSetMapping element concurrently.
- The value that can be specified is the class name.
- Default value
- void.class
(e) resultSetMapping element
- Type
- String
- Description
- This element specifies the name indicated in the name element of @SqlResultSetMapping in which the result set is defined.
- This element is specified when the SQL results are to be mapped to any result set.
- Do not specify the resultClass element and resultSetMapping element concurrently.
- You can specify the value within the specifiable range of the name element of @SqlResultSetMapping. For details, see 2.7.57(2)(a) name element.
- Default value
- Null character string