/** * Construct a locking strategy based on SQL UPDATE statements. * * @param lockable The metadata for the entity to be locked. * @param lockMode Indicates the type of lock to be acquired. Note that read-locks are not valid for this strategy. */ public PessimisticWriteUpdateLockingStrategy(Lockable lockable, LockMode lockMode) { this.lockable = lockable; this.lockMode = lockMode; if ( lockMode.lessThan( LockMode.PESSIMISTIC_READ ) ) { throw new HibernateException( "[" + lockMode + "] not valid for update statement" ); } if ( !lockable.isVersioned() ) { LOG.writeLocksNotSupported( lockable.getEntityName() ); this.sql = null; } else { this.sql = generateLockString(); } }
/** * Construct a locking strategy based on SQL UPDATE statements. * * @param lockable The metadata for the entity to be locked. * @param lockMode Indicates the type of lock to be acquired. Note that read-locks are not valid for this strategy. */ public PessimisticWriteUpdateLockingStrategy(Lockable lockable, LockMode lockMode) { this.lockable = lockable; this.lockMode = lockMode; if ( lockMode.lessThan( LockMode.PESSIMISTIC_READ ) ) { throw new HibernateException( "[" + lockMode + "] not valid for update statement" ); } if ( !lockable.isVersioned() ) { LOG.writeLocksNotSupported( lockable.getEntityName() ); this.sql = null; } else { this.sql = generateLockString(); } }
/** * Construct a locking strategy based on SQL UPDATE statements. * * @param lockable The metadata for the entity to be locked. * @param lockMode Indicates the type of lock to be acquired. Note that read-locks are not valid for this strategy. */ public PessimisticWriteUpdateLockingStrategy(Lockable lockable, LockMode lockMode) { this.lockable = lockable; this.lockMode = lockMode; if ( lockMode.lessThan( LockMode.PESSIMISTIC_READ ) ) { throw new HibernateException( "[" + lockMode + "] not valid for update statement" ); } if ( !lockable.isVersioned() ) { LOG.writeLocksNotSupported( lockable.getEntityName() ); this.sql = null; } else { this.sql = generateLockString(); } }
/** * Construct a locking strategy based on SQL UPDATE statements. * * @param lockable The metadata for the entity to be locked. * @param lockMode Indicates the type of lock to be acquired. Note that read-locks are not valid for this strategy. */ public PessimisticWriteUpdateLockingStrategy(Lockable lockable, LockMode lockMode) { this.lockable = lockable; this.lockMode = lockMode; if ( lockMode.lessThan( LockMode.PESSIMISTIC_READ ) ) { throw new HibernateException( "[" + lockMode + "] not valid for update statement" ); } if ( StringHelper.isEmpty( lockable.getVersionColumnName() ) ) { LOG.writeLocksNotSupported( lockable.getEntityName() ); this.sql = null; } else { this.sql = generateLockString(); } }