I have use hibernate version features without change legacy database
Is it possible set version in another table.For instance :
Table A
ID - primary key
properties
Version table A_version
ID (primary key same table A)
version long
Tables A and A_version have one-to-one mapping and ID can be composite ID.
When load object from table A, hibernate load version from table A_version
(if row in A_version doesn't exists, hibernate create one with version=1)
When user update table A hibernate do first
update A_version
where ID=... and version=_version
If update version success, then continue update A - else return 'another user update this row' or like message
regards
|