The NamedStoredProcedureQuery annotation can be applied to an
entity or mapped superclass.
The name element is the name that is passed as an argument
to the EntityManager#createNamedStoredProcedureQuery method to
create an executable StoredProcedureQuery object. Names are
scoped to the persistence unit.
The procedureName element is the name of the stored procedure
in the database.
The parameters of the stored procedure are specified by the
parameters element. Parameters must be specified in the order
in which they occur in the parameter list of the stored procedure.
The resultClasses element refers to the class (or classes)
that are used to map the results. The resultSetMappings element
names one or more result set mappings, as defined by the
SqlResultSetMapping annotation.
If there are multiple result sets, it is assumed that they are
mapped using the same mechanism — e.g., either all via a set of
result class mappings or all via a set of result set mappings. The
order of the specification of these mappings must be the same as the
order in which the result sets are returned by the stored procedure
invocation. If the stored procedure returns one or more result sets
and no resultClasses or resultSetMappings are
specified, any result set is returned as a list of type
Object[]. The combining of different strategies for the mapping
of stored procedure result sets is undefined.
The hints element may be used to specify query properties
and hints. Properties defined by this specification must be observed
by the provider. Vendor-specific hints that are not recognized by a
provider must be ignored.
All parameters of a named stored procedure query must be specified
using the StoredProcedureParameter annotation.
StoredProcedureQuery, StoredProcedureParameter
| Modifier and Type | Method and Description |
|---|---|
| public QueryHint[] | |
| public String | name()
The name used to refer to the query with the |
| public StoredProcedureParameter[] | |
| public String | |
| public Class | |
| public String[] |
| hints | back to summary |
|---|---|
| public QueryHint[] hints() Query properties and hints. (May include vendor-specific query hints.) | |
| name | back to summary |
|---|---|
| public String name() The name used to refer to the query with the | |
| parameters | back to summary |
|---|---|
| public StoredProcedureParameter[] parameters() Information about all parameters of the stored procedure. Parameters must be specified in the order in which they occur in the parameter list of the stored procedure. | |
| procedureName | back to summary |
|---|---|
| public String procedureName() The name of the stored procedure in the database. | |
| resultClasses | back to summary |
|---|---|
| public Class The class or classes that are used to map the results. | |
| resultSetMappings | back to summary |
|---|---|
| public String[] resultSetMappings() The names of one or more result set mappings, as defined in metadata. | |