Skip Headers
Oracle® Containers for J2EE Enterprise JavaBeans Developer's Guide
10g Release 3 (10.1.3)
B14428-01
  Go To Documentation Library
Home
Go To Product List
Solution Area
Go To Table Of Contents
Contents
Go To Index
Index

Previous
Previous
Next
Next
 

Configuring Optimistic Lock Version Field

You can specify an entity field to function as a version field for use in a TopLink optimistic version locking policy. OC4J uses this version field to ensure integrity when reattaching (see "Detaching and Merging a CMP Entity Bean Instance") and for overall optimistic concurrency control.

You define the optimistic lock version field at one of the property (getter or setter method) or field level of your entity.

For more information, see "Optimistic Version Locking Policies" in the Oracle TopLink Developer's Guide.

Using Annotations

Example 7-24 shows how to use the @Version annotation to define an optimistic version locking policy using column VERSION.

Example 7-24 @Version

@Version
@Column(name="VERSION")
public int getVersion()
{
    return version;
}