Optimistic concurrency(version) field comes twice in audited table

Description

I am using nhibernate envers for auditing. creating a corresponding audit table for each table in database.

Envers needs two fields mandatory: one version and another time stamp. And for optimistic concurrency nhibernate needs version field is also needed in main table.

lets say: TableA { id , version , name } then as per envers the audit table with have: { id, version, name, revision, revisionType }

the fields in audit table: version and revision would be exactly same, both contains the version of an entry.

If i remove the version field from main table, then optimistic concurrency will not work with nhibernate and for envers it is mandatory to specify a revision field. it does not reuse any field from main table. or has no feature to enable creation of revision field in main table.

if you can add such a property, it would be nice.

Environment

None

Activity

Show:
Roger
March 17, 2013, 10:33 AM

<<lets say: TableA { id , version , name } then as per envers the audit table with have: { id, version, name, revision, revisionType }>>

No. Unless you set nhibernate.envers.do_not_audit_optimistic_locking_field explicitly to false.

<<the fields in audit table: version and revision would be exactly same, both contains the version of an entry. >>

No. Optimistic lock version and audit revision is two different concepts. Audit revision is a global incremental number. Optimistic lock version number is unique per entity.

If you have user questions, please ask them here
https://groups.google.com/forum/?fromgroups#!forum/nhusers

Assignee

Unassigned

Reporter

Harish Rathi

Labels

Components

Affects versions

Priority

Major
Configure