Use @NamedPLSQLStoredFunctionQuery
to define queries that call Oracle PLSQL stored functions as named queries
Table 2-35 describes this annotation's elements.
Table 2-35 @NamedPLSQLStoredFunctionQuery Annotation Elements
Annotation Element | Description | Default |
---|---|---|
|
(Required) The name of the stored function. |
|
|
(Required) The unique name that references this stored function query. |
|
|
(Required) The return value of the stored function. |
|
|
(Optional) Query hints |
|
|
(Optional) The parameters for the stored function. |
|
|
(Optional) The name of the |
This annotation adds support for complex PLSQL types such as RECORD
and TABLE
, that are not accessible from JDBC.
You can specify @NamedPLSQLStoredFunctionQuery
on an Entity or MappedSuperclass.
Example 2-67 shows how to use this annotation.
Example 2-67 Using @NamedPLSQLStoredFunctionQuery Annotation
@NamedPLSQLStoredFunctionQuery(
name="getEmployee",
functionName="EMP_PKG.GET_EMP",
returnParameter=@PLSQLParameter(
name="RESULT",
databaseType="EMP_PKG.EMP_REC"
)
)
@Embeddable
@Struct(name="EMP_TYPE", fields={"F_NAME", "L_NAME", "SALARY"})
@PLSQLRecord(
name="EMP_PKG.EMP_REC",
compatibleType="EMP_TYPE",
javaType=Employee.class,
fields={
@PLSQLParameter(name="F_NAME"),
@PLSQLParameter(name="L_NAME"),
@PLSQLParameter(
name="SALARY",
databaseType="NUMERIC_TYPE"
)
}
)
public class Employee { ...}
For more information, see: