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


Use @Struct to define a class to map to a database Struct type. The class should normally be an Embeddable, but could also be an Entity if stored in a object table.

Annotation Elements

Table 2-64 describes this annotation's elements.

Table 2-64 @Struct Annotation Elements

Annotation Element Description Default


(Required) The database name of the database structure type.


(Optional) Defines the order of the fields contained in the database structure type.


Struct types are extended object-relational data-types supported by some databases. Struct types are user define types in the database such as OBJECT types on Oracle. Structs normally contain Arrays (VARRAY) or other Struct types, and can be stored in a column or a table.

You can also use Struct types to call PL/SQL stored procedures that use RECORD types in an Oracle Database.


Example 2-103 shows using the @Struct annotation to define a Java class to map to an OBJECT type.

Example 2-103 Using @Struct Annotation

@Struct(name="EMP_TYPE", fields={"F_NAME", "L_NAME", "SALARY"})
public class Employee {
 private String firstName;
 private String lastName;
 private BigDecimal salary;

Example 2-104 shows how to use the <struct> element in the eclipselink-orm.xml file.

Example 2-104 Using <struct> XML

<embeddable class="Address" access="FIELD">
  <struct name="PLSQL_P_PLSQL_ADDRESS_REC">
    <basic name="id">
      <column name="ADDRESS_ID"/>
    <basic name="number">
      <column name="STREET_NUM"/>

See Also

For more information, see: