[hibernate-dev] Using a checksum for version properties
Max Rydahl Andersen
max.andersen at redhat.com
Mon Apr 14 08:37:35 EDT 2008
Look at optimistic-lock in the docs.
/max
> 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
> _______________________________________________
> hibernate-dev mailing list
> hibernate-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/hibernate-dev
>
More information about the hibernate-dev
mailing list