Skip Headers

Oracle® Containers for J2EE Enterprise JavaBeans Developer's Guide 10g Release 3 (10.1.3) B14428-01 |
| Home | Solution Area | Contents | Index

Previous | 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;
    }