I am new to hibernate just to mention but I know that it has optimistic locking support. I was searching all day and I wasn't able to find tutorial how to implement it in some basic application.
So fore example I have this mysql table http://pastebin.com/m574200ce and I have this hibernate mapping file: http://pastebin.com/m2047dd98 (generated with NetBeans 6.5). What else do I need to add to this file to make optimistic locking which works on this simple table when I do (for example):
session.saveOrUpdate(user);
tx.commit();