Sun Java System Application Server Enterprise Edition 8.1 2005Q2 Developer's Guide

- Previous: Configuring Queries for 1.1 Finders
- Next: Relationship Prefetching

## Version Column Consistency Checking

The version consistency feature saves the bean state at first transactional access and caches it between transactions. The state is copied from the cache instead of being read from the database. The bean state is verified by primary key and version column values at flush for custom queries (for dirty instances only) and at commit (for clean and dirty instances).

### To use version consistency

1. Create the version column in the primary table.

2. Give the version column a numeric data type.

3. Provide appropriate update triggers on the version column.

   These triggers must increment the version column on each update of the specified row.

4. Specify the version column.

   This is specified in the check-version-of-accessed-instances subelement of the consistency element in the `sun-cmp-mappings.xml` file.

5. Map the CMP bean to an existing schema.

   Automatic schema generation is not supported for beans with version column consistency checking. Instead, work with your database administrator to create the schema and add the required triggers.

- Previous: Configuring Queries for 1.1 Finders
- Next: Relationship Prefetching

- © 2010, Oracle Corporation and/or its affiliates