Annotation Type NamedStoredProcedureQuery
-
@Repeatable(NamedStoredProcedureQueries.class) @Target(TYPE) @Retention(RUNTIME) public @interface NamedStoredProcedureQuery
Specifies and names a stored procedure, its parameters, and its result type.The
NamedStoredProcedureQueryannotation can be applied to an entity or mapped superclass.The
nameelement is the name that is passed as an argument to theEntityManager.createNamedStoredProcedureQuery(java.lang.String)method to create an executableStoredProcedureQueryobject. Names are scoped to the persistence unit.The
procedureNameelement is the name of the stored procedure in the database.The parameters of the stored procedure are specified by the
parameterselement. All parameters must be specified in the order in which they occur in the parameter list of the stored procedure.The
resultClasseselement refers to the class (or classes) that are used to map the results. TheresultSetMappingselement names one or more result set mappings, as defined by theSqlResultSetMappingannotation.If there are multiple result sets, it is assumed that they will be 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 will be returned by the stored procedure invocation. If the stored procedure returns one or more result sets and no
resultClassesorresultSetMappingselement is specified, any result set will be returned as a list of type Object[]. The combining of different strategies for the mapping of stored procedure result sets is undefined.The
hintselement 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
StoredProcedureParameterannotation.- See Also:
StoredProcedureQuery,StoredProcedureParameter- Since:
- 2.1
-
-
Required Element Summary
Required Elements Modifier and Type Required Element Description java.lang.StringnameThe name used to refer to the query with theEntityManagermethods that create stored procedure query objects.java.lang.StringprocedureNameThe name of the stored procedure in the database.
-
Optional Element Summary
Optional Elements Modifier and Type Optional Element Description QueryHint[]hintsQuery properties and hints.StoredProcedureParameter[]parametersInformation about all parameters of the stored procedure.java.lang.Class[]resultClassesThe class or classes that are used to map the results.java.lang.String[]resultSetMappingsThe names of one or more result set mappings, as defined in metadata.
-
-
-
Element Detail
-
name
java.lang.String name
The name used to refer to the query with theEntityManagermethods that create stored procedure query objects.
-
-
-
parameters
StoredProcedureParameter[] parameters
Information about all parameters of the stored procedure. All parameters must be specified in the order in which they occur in the parameter list of the stored procedure.- Default:
- {}
-
-
-
hints
QueryHint[] hints
Query properties and hints. (May include vendor-specific query hints.)- Default:
- {}
-
-