当前位置: 首页>>代码示例>>Java>>正文


Java Lockable类代码示例

本文整理汇总了Java中org.hibernate.persister.entity.Lockable的典型用法代码示例。如果您正苦于以下问题:Java Lockable类的具体用法?Java Lockable怎么用?Java Lockable使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Lockable类属于org.hibernate.persister.entity包,在下文中一共展示了Lockable类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getLockingStrategy

import org.hibernate.persister.entity.Lockable; //导入依赖的package包/类
/**
 * For HSQLDB 2.0, this is a copy of the base class implementation.
 * For HSQLDB 1.8, only READ_UNCOMMITTED is supported.
 *
 * @param lockable The persister for the entity to be locked.
 * @param lockMode The type of lock to be acquired.
 *
 * @return The appropriate locking strategy.
 *
 * @since 3.2
 */
public LockingStrategy getLockingStrategy(Lockable lockable, LockMode lockMode) {
        if ( lockMode == LockMode.PESSIMISTIC_FORCE_INCREMENT ) {
                return new PessimisticForceIncrementLockingStrategy( lockable, lockMode );
        }
        else if ( lockMode == LockMode.PESSIMISTIC_WRITE ) {
                return new PessimisticWriteSelectLockingStrategy( lockable, lockMode );
        }
        else if ( lockMode == LockMode.PESSIMISTIC_READ ) {
                return new PessimisticReadSelectLockingStrategy( lockable, lockMode );
        }
        else if ( lockMode == LockMode.OPTIMISTIC ) {
                return new OptimisticLockingStrategy( lockable, lockMode );
        }
        else if ( lockMode == LockMode.OPTIMISTIC_FORCE_INCREMENT ) {
                return new OptimisticForceIncrementLockingStrategy( lockable, lockMode );
        }

        if ( hsqldbVersion < 20 ) {
                return new ReadUncommittedLockingStrategy( lockable, lockMode );
        }
        else {
                return new SelectLockingStrategy( lockable, lockMode );
        }
}
 
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:36,代码来源:HSQLDialect.java

示例2: getLockingStrategy

import org.hibernate.persister.entity.Lockable; //导入依赖的package包/类
/**
 * For HSQLDB 2.0, this is a copy of the base class implementation.
 * For HSQLDB 1.8, only READ_UNCOMMITTED is supported.
 * <p/>
 * {@inheritDoc}
 */
@Override
public LockingStrategy getLockingStrategy(Lockable lockable, LockMode lockMode) {
	if ( lockMode == LockMode.PESSIMISTIC_FORCE_INCREMENT ) {
		return new PessimisticForceIncrementLockingStrategy( lockable, lockMode );
	}
	else if ( lockMode == LockMode.PESSIMISTIC_WRITE ) {
		return new PessimisticWriteSelectLockingStrategy( lockable, lockMode );
	}
	else if ( lockMode == LockMode.PESSIMISTIC_READ ) {
		return new PessimisticReadSelectLockingStrategy( lockable, lockMode );
	}
	else if ( lockMode == LockMode.OPTIMISTIC ) {
		return new OptimisticLockingStrategy( lockable, lockMode );
	}
	else if ( lockMode == LockMode.OPTIMISTIC_FORCE_INCREMENT ) {
		return new OptimisticForceIncrementLockingStrategy( lockable, lockMode );
	}

	if ( hsqldbVersion < 20 ) {
		return new ReadUncommittedLockingStrategy( lockable, lockMode );
	}
	else {
		return new SelectLockingStrategy( lockable, lockMode );
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:32,代码来源:HSQLDialect.java

示例3: getLockingStrategy

import org.hibernate.persister.entity.Lockable; //导入依赖的package包/类
@Override
public LockingStrategy getLockingStrategy(Lockable lockable, LockMode lockMode) {
	// InterSystems Cache' does not current support "SELECT ... FOR UPDATE" syntax...
	// Set your transaction mode to READ_COMMITTED before using
	if ( lockMode==LockMode.PESSIMISTIC_FORCE_INCREMENT) {
		return new PessimisticForceIncrementLockingStrategy( lockable, lockMode);
	}
	else if ( lockMode==LockMode.PESSIMISTIC_WRITE) {
		return new PessimisticWriteUpdateLockingStrategy( lockable, lockMode);
	}
	else if ( lockMode==LockMode.PESSIMISTIC_READ) {
		return new PessimisticReadUpdateLockingStrategy( lockable, lockMode);
	}
	else if ( lockMode==LockMode.OPTIMISTIC) {
		return new OptimisticLockingStrategy( lockable, lockMode);
	}
	else if ( lockMode==LockMode.OPTIMISTIC_FORCE_INCREMENT) {
		return new OptimisticForceIncrementLockingStrategy( lockable, lockMode);
	}
	else if ( lockMode.greaterThan( LockMode.READ ) ) {
		return new UpdateLockingStrategy( lockable, lockMode );
	}
	else {
		return new SelectLockingStrategy( lockable, lockMode );
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:27,代码来源:Cache71Dialect.java

示例4: getLockingStrategy

import org.hibernate.persister.entity.Lockable; //导入依赖的package包/类
@Override
public LockingStrategy getLockingStrategy(Lockable lockable, LockMode lockMode) {
	// TimesTen has no known variation of a "SELECT ... FOR UPDATE" syntax...
	if ( lockMode == LockMode.PESSIMISTIC_FORCE_INCREMENT ) {
		return new PessimisticForceIncrementLockingStrategy( lockable, lockMode );
	}
	else if ( lockMode == LockMode.PESSIMISTIC_WRITE ) {
		return new PessimisticWriteUpdateLockingStrategy( lockable, lockMode );
	}
	else if ( lockMode == LockMode.PESSIMISTIC_READ ) {
		return new PessimisticReadUpdateLockingStrategy( lockable, lockMode );
	}
	else if ( lockMode == LockMode.OPTIMISTIC ) {
		return new OptimisticLockingStrategy( lockable, lockMode );
	}
	else if ( lockMode == LockMode.OPTIMISTIC_FORCE_INCREMENT ) {
		return new OptimisticForceIncrementLockingStrategy( lockable, lockMode );
	}
	else if ( lockMode.greaterThan( LockMode.READ ) ) {
		return new UpdateLockingStrategy( lockable, lockMode );
	}
	else {
		return new SelectLockingStrategy( lockable, lockMode );
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:26,代码来源:TimesTenDialect.java

示例5: getLockingStrategy

import org.hibernate.persister.entity.Lockable; //导入依赖的package包/类
@Override
public LockingStrategy getLockingStrategy(Lockable lockable, LockMode lockMode) {
	// Pointbase has no known variation of a "SELECT ... FOR UPDATE" syntax...
	if ( lockMode==LockMode.PESSIMISTIC_FORCE_INCREMENT) {
		return new PessimisticForceIncrementLockingStrategy( lockable, lockMode);
	}
	else if ( lockMode==LockMode.PESSIMISTIC_WRITE) {
		return new PessimisticWriteUpdateLockingStrategy( lockable, lockMode);
	}
	else if ( lockMode==LockMode.PESSIMISTIC_READ) {
		return new PessimisticReadUpdateLockingStrategy( lockable, lockMode);
	}
	else if ( lockMode==LockMode.OPTIMISTIC) {
		return new OptimisticLockingStrategy( lockable, lockMode);
	}
	else if ( lockMode==LockMode.OPTIMISTIC_FORCE_INCREMENT) {
		return new OptimisticForceIncrementLockingStrategy( lockable, lockMode);
	}
	else if ( lockMode.greaterThan( LockMode.READ ) ) {
		return new UpdateLockingStrategy( lockable, lockMode );
	}
	else {
		return new SelectLockingStrategy( lockable, lockMode );
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:26,代码来源:PointbaseDialect.java

示例6: getLockingStrategy

import org.hibernate.persister.entity.Lockable; //导入依赖的package包/类
@Override
public LockingStrategy getLockingStrategy(Lockable lockable, LockMode lockMode) {
	// RDMS has no known variation of a "SELECT ... FOR UPDATE" syntax...
	if ( lockMode == LockMode.PESSIMISTIC_FORCE_INCREMENT ) {
		return new PessimisticForceIncrementLockingStrategy( lockable, lockMode );
	}
	else if ( lockMode == LockMode.PESSIMISTIC_WRITE ) {
		return new PessimisticWriteUpdateLockingStrategy( lockable, lockMode );
	}
	else if ( lockMode == LockMode.PESSIMISTIC_READ ) {
		return new PessimisticReadUpdateLockingStrategy( lockable, lockMode );
	}
	else if ( lockMode == LockMode.OPTIMISTIC ) {
		return new OptimisticLockingStrategy( lockable, lockMode );
	}
	else if ( lockMode == LockMode.OPTIMISTIC_FORCE_INCREMENT ) {
		return new OptimisticForceIncrementLockingStrategy( lockable, lockMode );
	}
	else if ( lockMode.greaterThan( LockMode.READ ) ) {
		return new UpdateLockingStrategy( lockable, lockMode );
	}
	else {
		return new SelectLockingStrategy( lockable, lockMode );
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:26,代码来源:RDMSOS2200Dialect.java

示例7: getLockingStrategy

import org.hibernate.persister.entity.Lockable; //导入依赖的package包/类
@Override
public LockingStrategy getLockingStrategy(Lockable lockable, LockMode lockMode) {
	// Mckoi has no known variation of a "SELECT ... FOR UPDATE" syntax...
	if ( lockMode==LockMode.PESSIMISTIC_FORCE_INCREMENT) {
		return new PessimisticForceIncrementLockingStrategy( lockable, lockMode);
	}
	else if ( lockMode==LockMode.PESSIMISTIC_WRITE) {
		return new PessimisticWriteUpdateLockingStrategy( lockable, lockMode);
	}
	else if ( lockMode==LockMode.PESSIMISTIC_READ) {
		return new PessimisticReadUpdateLockingStrategy( lockable, lockMode);
	}
	else if ( lockMode==LockMode.OPTIMISTIC) {
		return new OptimisticLockingStrategy( lockable, lockMode);
	}
	else if ( lockMode==LockMode.OPTIMISTIC_FORCE_INCREMENT) {
		return new OptimisticForceIncrementLockingStrategy( lockable, lockMode);
	}
	else if ( lockMode.greaterThan( LockMode.READ ) ) {
		return new UpdateLockingStrategy( lockable, lockMode );
	}
	else {
		return new SelectLockingStrategy( lockable, lockMode );
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:26,代码来源:MckoiDialect.java

示例8: getLockingStrategy

import org.hibernate.persister.entity.Lockable; //导入依赖的package包/类
/**
 * Get a strategy instance which knows how to acquire a database-level lock
 * of the specified mode for this dialect.
 *
 * @param lockable The persister for the entity to be locked.
 * @param lockMode The type of lock to be acquired.
 * @return The appropriate locking strategy.
 * @since 3.2
 */
public LockingStrategy getLockingStrategy(Lockable lockable, LockMode lockMode) {
	switch ( lockMode ) {
		case PESSIMISTIC_FORCE_INCREMENT:
			return new PessimisticForceIncrementLockingStrategy( lockable, lockMode );
		case PESSIMISTIC_WRITE:
			return new PessimisticWriteSelectLockingStrategy( lockable, lockMode );
		case PESSIMISTIC_READ:
			return new PessimisticReadSelectLockingStrategy( lockable, lockMode );
		case OPTIMISTIC:
			return new OptimisticLockingStrategy( lockable, lockMode );
		case OPTIMISTIC_FORCE_INCREMENT:
			return new OptimisticForceIncrementLockingStrategy( lockable, lockMode );
		default:
			return new SelectLockingStrategy( lockable, lockMode );
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:26,代码来源:Dialect.java

示例9: getLockingStrategy

import org.hibernate.persister.entity.Lockable; //导入依赖的package包/类
@Override
public LockingStrategy getLockingStrategy(Lockable lockable, LockMode lockMode) {
	// Frontbase has no known variation of a "SELECT ... FOR UPDATE" syntax...
	if ( lockMode==LockMode.PESSIMISTIC_FORCE_INCREMENT) {
		return new PessimisticForceIncrementLockingStrategy( lockable, lockMode);
	}
	else if ( lockMode==LockMode.PESSIMISTIC_WRITE) {
		return new PessimisticWriteUpdateLockingStrategy( lockable, lockMode);
	}
	else if ( lockMode==LockMode.PESSIMISTIC_READ) {
		return new PessimisticReadUpdateLockingStrategy( lockable, lockMode);
	}
	else if ( lockMode==LockMode.OPTIMISTIC) {
		return new OptimisticLockingStrategy( lockable, lockMode);
	}
	else if ( lockMode==LockMode.OPTIMISTIC_FORCE_INCREMENT) {
		return new OptimisticForceIncrementLockingStrategy( lockable, lockMode);
	}
	else if ( lockMode.greaterThan( LockMode.READ ) ) {
		return new UpdateLockingStrategy( lockable, lockMode );
	}
	else {
		return new SelectLockingStrategy( lockable, lockMode );
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:26,代码来源:FrontBaseDialect.java

示例10: getLockingStrategy

import org.hibernate.persister.entity.Lockable; //导入依赖的package包/类
@Override
public LockingStrategy getLockingStrategy(Lockable lockable, LockMode lockMode) {
	if ( lockMode == LockMode.PESSIMISTIC_FORCE_INCREMENT ) {
		return new PessimisticForceIncrementLockingStrategy( lockable, lockMode );
	}
	// else if ( lockMode==LockMode.PESSIMISTIC_WRITE ) {
	// return new PessimisticWriteLockingStrategy( lockable, lockMode );
	// }
	else if ( lockMode == LockMode.PESSIMISTIC_READ ) {
		return new IgnitePessimisticReadLockingStrategy( lockable, lockMode, provider );
	}
	else if ( lockMode == LockMode.OPTIMISTIC ) {
		return new OptimisticLockingStrategy( lockable, lockMode );
	}
	else if ( lockMode == LockMode.OPTIMISTIC_FORCE_INCREMENT ) {
		return new OptimisticForceIncrementLockingStrategy( lockable, lockMode );
	}
	else {
		return null;
	}
}
 
开发者ID:hibernate,项目名称:hibernate-ogm-ignite,代码行数:22,代码来源:IgniteDialect.java

示例11: applyLocks

import org.hibernate.persister.entity.Lockable; //导入依赖的package包/类
protected String applyLocks(String sqlSelectString, Map lockModes, Dialect dialect) throws QueryException {
	if ( lockModes == null || lockModes.isEmpty() ) {
		return sqlSelectString;
	}

	final Map aliasedLockModes = new HashMap();
	final Map keyColumnNames = dialect.forUpdateOfColumns() ? new HashMap() : null;
	final String[] drivingSqlAliases = getAliases();
	for ( int i = 0; i < drivingSqlAliases.length; i++ ) {
		final LockMode lockMode = ( LockMode ) lockModes.get( drivingSqlAliases[i] );
		if ( lockMode != null ) {
			final Lockable drivingPersister = ( Lockable ) getEntityPersisters()[i];
			final String rootSqlAlias = drivingPersister.getRootTableAlias( drivingSqlAliases[i] );
			aliasedLockModes.put( rootSqlAlias, lockMode );
			if ( keyColumnNames != null ) {
				keyColumnNames.put( rootSqlAlias, drivingPersister.getRootTableIdentifierColumnNames() );
			}
		}
	}
	return dialect.applyLocksToSql( sqlSelectString, aliasedLockModes, keyColumnNames );
}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:22,代码来源:CriteriaLoader.java

示例12: UpdateLockingStrategy

import org.hibernate.persister.entity.Lockable; //导入依赖的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

示例13: OptimisticLockingStrategy

import org.hibernate.persister.entity.Lockable; //导入依赖的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

示例14: PessimisticForceIncrementLockingStrategy

import org.hibernate.persister.entity.Lockable; //导入依赖的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

示例15: PessimisticWriteUpdateLockingStrategy

import org.hibernate.persister.entity.Lockable; //导入依赖的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


注:本文中的org.hibernate.persister.entity.Lockable类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。