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


@ReturnUpdate

Use @ReturnUpdate to cause UPDATE 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.


NoteNote:

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

This annotation contains no elements.


Usage

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


Examples

Example 2-101 shows how to use the @ReturnUpdate annotation. The annotation does not accept any arguments.

Example 2-101 Using @ReturnUpdate Annotation

@ReturnUpdate
public String getFirstName() {
    return firstName;
}

Example 2-102 illustrates the same example as before, but uses the <return-update> element in the eclipselink-orm.xml mapping file.

Example 2-102 Using <return-update> XML

<basic name="firstName">
    <column name="F_NAME"/>
    <return-update/>
</basic>


See Also

For more information, see: