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


Use @ReturnInsert to cause INSERT operations to return values back into the object being written. This allows for table default values, trigger or stored procedures computed values to be set back into the object.


Returning is only supported with an Oracle Database and requires an INSERT RETURNING clause.

To use returning with other databases, a stored procedure with output parameters is used for the insert query.

Annotation Elements

Table 2-61 describes this annotation's elements.

Table 2-61 @ReturnInsert Annotation Elements

Annotation Element Description Default


(Optional) If specified (true), the mapping field will be excluded from the INSERT clause during SQL generation.



A @ReturnInsert annotation can only be specified on a Basic mapping.


Example 2-99 shows how to use the @ReturnInsert annotation. If you do not use an argument, EclipseLink accepts the default value, false.

Example 2-99 Using @ReturnInsert Annotation

 public String getFirstName() {
     return firstName;

Example 2-100 shows how to use the <return-insert> element in the eclipselink-orm.xml file.

Example 2-100 Using <return-insert> XML

<basic name="firstName">
    <column name="FIRST_NAME"/>
    <return-insert read-only="true"/>

See Also

For more information, see: