Java Persistence API (JPA) Extensions Reference for EclipseLink, Release 2.5
  Go To Table Of Contents


Use @PLSQLRecord to define a database PLSQL RECORD type for use within PLSQL procedures.

Annotation Elements

Table 2-52 describes this annotation's elements.

Table 2-52 @PLSQLRecord Annotation Elements

Annotation Element Description Default


(Required) The name of the record type in the database.


(Required) Name of the database OBJECTYPE that mirror's the record's structure.


(Required) The fields in the record type.


(Optional) The class to which to the object type. You must map this class with the @Struct annotation.


Oracle PLSQL RECORD types are structured database types. Although JDBC does not provide a mechanism for returning these types, EclipseLink provides support to translate these types into OBJECT types. You must create an OBJECT type on the database to mirror the RECORD type and provide it as the compatibileType in the @PLSQLRecord.

You can then map the RECORD to a Java class, map the Java class as an @Embeddable, use the @Struct annotations to map the Java class to the OBJECT type that mirrors the RECORD type.

You can then call and return the Java class as parameters to the PLSQL stored procedure query.


Example 2-90 shows how to use this annotation.

Example 2-90 Using @PLSQLRecord Annotation

@NamedPLSQLStoredFunctionQuery(name="getEmployee", functionName="EMP_PKG.GET_EMP",
    returnParameter=@PLSQLParameter(name="RESULT", databaseType="EMP_PKG.EMP_REC"))
@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: