public void lock(Serializable id, Object version, Object object, int timeout, SessionImplementor session) {
if ( !lockable.isVersioned() ) {
throw new HibernateException( "[" + lockMode + "] not supported for non-versioned entities [" + lockable.getEntityName() + "]" );
}
EntityEntry entry = session.getPersistenceContext().getEntry( object );
EntityIncrementVersionProcess incrementVersion = new EntityIncrementVersionProcess( object, entry );
EventSource source = (EventSource) session;
// Register the EntityIncrementVersionProcess action to run just prior to transaction commit.
source.getActionQueue().registerProcess( incrementVersion );
}