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).
Create the version column in the primary table.
Give the version column a numeric data type.
Provide appropriate update triggers on the version column.
These triggers must increment the version column on each update of the specified row.
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. See consistency in Sun GlassFish Enterprise Server 2.1 Application Deployment Guide.
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.