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.
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.
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 |
false |
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, Oracle TopLink accepts the default value, false
.
Example 2-99 Using @ReturnInsert Annotation
@ReturnInsert(returnOnly=true)
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"/>
</basic>
For more information, see:
Understanding Oracle TopLink