Use @NamedStoredFunctionQuery
to define queries that call stored functions as named queries.
Annotation Elements
Table 2-39 describes this annotation's elements.
Table 2-39 @NamedStoredFunctionQuery Annotation Elements
Annotation Element | Description | Default |
---|---|---|
|
(Required) The name of the stored function. |
|
name |
(Required) The unique name that references this stored function query. |
|
|
(Required) The return value of the stored function. |
|
|
(Optional) Specifies if the stored function should be called by index or by name.
|
false |
|
(Optional) Query hints |
|
|
(Optional) The parameters for the stored function. |
|
|
(Optional) The name of the SQLResultMapping. |
Usage
You can specify @NamedStoredFunctionQuery
on an Entity or MappedSuperclass.
Examples
Example 2-71 shows how to use this annotation.
Example 2-71 Using @NamedStoredFunctionQuery Annotation
@Entity @Table(name="CMP3_ADDRESS") @NamedStoredFunctionQuery( name="StoredFunction_In", functionName="StoredFunction_In", parameters={ @StoredProcedureParameter(direction=IN, name="P_IN", queryParameter="P_IN", type=Long.class) }, returnParameter=@StoredProcedureParameter(queryParameter="RETURN", type=Long.class) ) public class Address implements Serializable { ... }
Example 2-72 shows how to use the <named-stored-function-query>
element in the eclipselink-orm.xml
file.
Example 2-72 Using <named-stored-function-query> XML
<named-stored-function-query name="StoredFunction_In" procedure-name="StoredFunction_In"> <parameter direction="IN" name="P_IN" query-parameter="P_IN" type="Long"/> </named-stored-function-query>
See Also
For more information, see: