[hibernate-dev] Using a checksum for version properties
Tom
808131 at gmail.com
Mon Apr 14 05:29:34 EDT 2008
Hi,
We have some database tables that we can't add version columns to so I
would like to instead create a version number by using checksums on
the rows.
I'm thinking specifically of Oracle here but I assume other platforms
may have equivalent features; the sort of query I am looking at using
is...
select id, name, salary,
dbms_crypto.hash(utl_raw.cast_to_raw(id || name ||
salary), 1) as version
from employees
In this example, the version column is populated with the MD4 sum of
the three properties.
I've tried to create a custom EntityPersister but it looks like I'll
need to dig deeper. My plan would be to create the checksum code
automatically depending on the 'versionability' of the properties.
If this sounds useful/sane I am happy to work on a patch.
Regards,
Tom
More information about the hibernate-dev
mailing list