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.
Note:
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.
This annotation contains no elements.
A @ReturnUpdate
annotation can only be specified on a Basic
mapping.
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>
For more information, see:
Understanding Oracle TopLink