當前位置: 首頁>>代碼示例>>Java>>正文


Java LockMode.lessThan方法代碼示例

本文整理匯總了Java中org.hibernate.LockMode.lessThan方法的典型用法代碼示例。如果您正苦於以下問題:Java LockMode.lessThan方法的具體用法?Java LockMode.lessThan怎麽用?Java LockMode.lessThan使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.hibernate.LockMode的用法示例。


在下文中一共展示了LockMode.lessThan方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: checkVersion

import org.hibernate.LockMode; //導入方法依賴的package包/類
private void checkVersion(
		ResultSet resultSet,
		ResultSetProcessingContext context,
		EntityKey entityKey,
		Object existing) {
	final LockMode requestedLockMode = context.resolveLockMode( entityReference );
	if ( requestedLockMode != LockMode.NONE ) {
		final LockMode currentLockMode = context.getSession().getPersistenceContext().getEntry( existing ).getLockMode();
		final boolean isVersionCheckNeeded = entityReference.getEntityPersister().isVersioned()
				&& currentLockMode.lessThan( requestedLockMode );

		// we don't need to worry about existing version being uninitialized because this block isn't called
		// by a re-entrant load (re-entrant loads *always* have lock mode NONE)
		if ( isVersionCheckNeeded ) {
			//we only check the version when *upgrading* lock modes
			checkVersion(
					context.getSession(),
					resultSet,
					entityReference.getEntityPersister(),
					entityReferenceAliases.getColumnAliases(),
					entityKey,
					existing
			);
			//we need to upgrade the lock mode to the mode requested
			context.getSession().getPersistenceContext().getEntry( existing ).setLockMode( requestedLockMode );
		}
	}
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:29,代碼來源:EntityReferenceInitializerImpl.java

示例2: UpdateLockingStrategy

import org.hibernate.LockMode; //導入方法依賴的package包/類
/**
 * Construct a locking strategy based on SQL UPDATE statements.
 *
 * @param lockable The metadata for the entity to be locked.
 * @param lockMode Indictates the type of lock to be acquired.  Note that
 * read-locks are not valid for this strategy.
 */
public UpdateLockingStrategy(Lockable lockable, LockMode lockMode) {
	this.lockable = lockable;
	this.lockMode = lockMode;
	if ( lockMode.lessThan( LockMode.UPGRADE ) ) {
		throw new HibernateException( "[" + lockMode + "] not valid for update statement" );
	}
	if ( !lockable.isVersioned() ) {
		LOG.writeLocksNotSupported( lockable.getEntityName() );
		this.sql = null;
	}
	else {
		this.sql = generateLockString();
	}
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:22,代碼來源:UpdateLockingStrategy.java

示例3: OptimisticLockingStrategy

import org.hibernate.LockMode; //導入方法依賴的package包/類
/**
 * Construct locking strategy.
 *
 * @param lockable The metadata for the entity to be locked.
 * @param lockMode Indicates the type of lock to be acquired.
 */
public OptimisticLockingStrategy(Lockable lockable, LockMode lockMode) {
	this.lockable = lockable;
	this.lockMode = lockMode;
	if ( lockMode.lessThan( LockMode.OPTIMISTIC ) ) {
		throw new HibernateException( "[" + lockMode + "] not valid for [" + lockable.getEntityName() + "]" );
	}
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:14,代碼來源:OptimisticLockingStrategy.java

示例4: PessimisticForceIncrementLockingStrategy

import org.hibernate.LockMode; //導入方法依賴的package包/類
/**
 * Construct locking strategy.
 *
 * @param lockable The metadata for the entity to be locked.
 * @param lockMode Indicates the type of lock to be acquired.
 */
public PessimisticForceIncrementLockingStrategy(Lockable lockable, LockMode lockMode) {
	this.lockable = lockable;
	this.lockMode = lockMode;
	// ForceIncrement can be used for PESSIMISTIC_READ, PESSIMISTIC_WRITE or PESSIMISTIC_FORCE_INCREMENT
	if ( lockMode.lessThan( LockMode.PESSIMISTIC_READ ) ) {
		throw new HibernateException( "[" + lockMode + "] not valid for [" + lockable.getEntityName() + "]" );
	}
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:15,代碼來源:PessimisticForceIncrementLockingStrategy.java

示例5: PessimisticWriteUpdateLockingStrategy

import org.hibernate.LockMode; //導入方法依賴的package包/類
/**
 * 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();
	}
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:21,代碼來源:PessimisticWriteUpdateLockingStrategy.java

示例6: OptimisticForceIncrementLockingStrategy

import org.hibernate.LockMode; //導入方法依賴的package包/類
/**
 * Construct locking strategy.
 *
 * @param lockable The metadata for the entity to be locked.
 * @param lockMode Indicates the type of lock to be acquired.
 */
public OptimisticForceIncrementLockingStrategy(Lockable lockable, LockMode lockMode) {
	this.lockable = lockable;
	this.lockMode = lockMode;
	if ( lockMode.lessThan( LockMode.OPTIMISTIC_FORCE_INCREMENT ) ) {
		throw new HibernateException( "[" + lockMode + "] not valid for [" + lockable.getEntityName() + "]" );
	}
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:14,代碼來源:OptimisticForceIncrementLockingStrategy.java

示例7: PessimisticReadUpdateLockingStrategy

import org.hibernate.LockMode; //導入方法依賴的package包/類
/**
 * 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 PessimisticReadUpdateLockingStrategy(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();
	}
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:22,代碼來源:PessimisticReadUpdateLockingStrategy.java


注:本文中的org.hibernate.LockMode.lessThan方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。