Hi,
I am using
Hibernate 3.1.3 .
In our Oracle 10g legacy database there is an existing VERSION column which is used to implement optimistic locking for existing (non-hibernate) front-end application. This column is inserted/updated by a trigger.
The column stores ASCII characters and whenever the trigger updates the column value, it converts the CHAR value to ASCII code and increments it by 1 or sets the value to 0 if the current ASCII value = Max ASCII code.
Why the CHAR(1) database type was originally used for the VERSION column? Because it takes only one byte in a table row.
I would like to utilise this this column for an optimistic locking in hibernate application. However, hibernate does not support neither string versions nor formula based versions where I could convert ASCII character to numeric ASCII code like in the example below.
Code:
<version name="version" type="integer" generated="always" insert="false">
<formula>ASCII(VERSION)</formula>
</version>
Is there any way to make hibernate to accept this column and not change the type of the VERSION column to numeric type in the database?
Thanks in advance,
Anton
Code: