Java Persistence API (JPA) Extensions Reference for EclipseLink, Release 2.4
  Go To Table Of Contents
 Search
 PDFComments
Comments


@NamedPLSQLStoredProcedureQuery

Use @NamedPLSQLStoredProcedureQuery to define queries that call Oracle PLSQL stored procedures as named queries


Annotation Elements

Table 2-34 describes this annotation's elements.

Table 2-34 @NamedPLSQLStoredProcedureQuery Annotation Elements

Annotation Element Description Default

procedureName

(Required) The name of the stored procedure.


name

(Required) The unique name that references this stored procedure query.


resultClass

(Optional) The class of the result.


hints

(Optional) Query hints


parameters

(Optional) The parameters for the stored procedure.


resultSetMapping

(Optional) The name of the SQLResultMapping.




Usage

This annotation adds support for complex PLSQL types such as RECORD and TABLE, that are not accessible from JDBC.

You can specify @NamedPLSQLStoredProcedureQuery on an Entity, Embeddable, or MappedSuperclass.


Examples

Example 2-67 shows how to use this annotation.

Example 2-67 Using @NamedPLSQLStoredProcedureQuery Annotation

@NamedPLSQLStoredProcedureQuery(
    name="getEmployee",
    functionName="EMP_PKG.GET_EMP", 
    parameters={
        @PLSQLParameter(
            name="EMP_OUT", 
            direction=Direction.OUT,
            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 { ...}


See Also

For more information, see: