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


Java LockMode.OPTIMISTIC_FORCE_INCREMENT属性代码示例

本文整理汇总了Java中org.hibernate.LockMode.OPTIMISTIC_FORCE_INCREMENT属性的典型用法代码示例。如果您正苦于以下问题:Java LockMode.OPTIMISTIC_FORCE_INCREMENT属性的具体用法?Java LockMode.OPTIMISTIC_FORCE_INCREMENT怎么用?Java LockMode.OPTIMISTIC_FORCE_INCREMENT使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.hibernate.LockMode的用法示例。


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

示例1: getLockingStrategy

/**
 * 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,代码行数:35,代码来源:HSQLDialect.java

示例2: convertToLockModeType

/**
 * Convert from the Hibernate specific LockMode to the JPA defined LockModeType.
 *
 * @param lockMode The Hibernate LockMode.
 *
 * @return The JPA LockModeType
 */
public static LockModeType convertToLockModeType(LockMode lockMode) {
	if ( lockMode == LockMode.NONE ) {
		return LockModeType.NONE;
	}
	else if ( lockMode == LockMode.OPTIMISTIC || lockMode == LockMode.READ ) {
		return LockModeType.OPTIMISTIC;
	}
	else if ( lockMode == LockMode.OPTIMISTIC_FORCE_INCREMENT || lockMode == LockMode.WRITE ) {
		return LockModeType.OPTIMISTIC_FORCE_INCREMENT;
	}
	else if ( lockMode == LockMode.PESSIMISTIC_READ ) {
		return LockModeType.PESSIMISTIC_READ;
	}
	else if ( lockMode == LockMode.PESSIMISTIC_WRITE
			|| lockMode == LockMode.UPGRADE
			|| lockMode == LockMode.UPGRADE_NOWAIT
               || lockMode == LockMode.UPGRADE_SKIPLOCKED) {
		return LockModeType.PESSIMISTIC_WRITE;
	}
	else if ( lockMode == LockMode.PESSIMISTIC_FORCE_INCREMENT
			|| lockMode == LockMode.FORCE ) {
		return LockModeType.PESSIMISTIC_FORCE_INCREMENT;
	}
	throw new AssertionFailure( "unhandled lock mode " + lockMode );
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:32,代码来源:LockModeConverter.java

示例3: getLockingStrategy

/**
 * 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,代码行数:31,代码来源:HSQLDialect.java

示例4: getLockingStrategy

@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,代码行数:26,代码来源:Cache71Dialect.java

示例5: getLockingStrategy

@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,代码行数:25,代码来源:TimesTenDialect.java

示例6: getLockingStrategy

@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,代码行数:25,代码来源:PointbaseDialect.java

示例7: getLockingStrategy

@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,代码行数:25,代码来源:RDMSOS2200Dialect.java

示例8: getLockingStrategy

@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,代码行数:25,代码来源:MckoiDialect.java

示例9: getLockingStrategy

@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,代码行数:25,代码来源:FrontBaseDialect.java

示例10: getLockingStrategy

@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,代码行数:21,代码来源:IgniteDialect.java

示例11: convertToLockMode

/**
 * Convert from JPA defined LockModeType to Hibernate specific LockMode.
 *
 * @param lockMode The JPA LockModeType
 *
 * @return The Hibernate LockMode.
 */
public static LockMode convertToLockMode(LockModeType lockMode) {
	switch ( lockMode ) {
		case READ:
		case OPTIMISTIC: {
			return LockMode.OPTIMISTIC;
		}
		case OPTIMISTIC_FORCE_INCREMENT:
		case WRITE: {
			return LockMode.OPTIMISTIC_FORCE_INCREMENT;
		}
		case PESSIMISTIC_READ: {
			return LockMode.PESSIMISTIC_READ;
		}
		case PESSIMISTIC_WRITE: {
			return LockMode.PESSIMISTIC_WRITE;
		}
		case PESSIMISTIC_FORCE_INCREMENT: {
			return LockMode.PESSIMISTIC_FORCE_INCREMENT;
		}
		case NONE: {
			return LockMode.NONE;
		}
		default: {
			throw new AssertionFailure( "Unknown LockModeType: " + lockMode );
		}
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:34,代码来源:LockModeConverter.java

示例12: getLockMode

private static LockMode getLockMode(String lockMode) {
	if ( lockMode == null || "read".equals( lockMode ) ) {
		return LockMode.READ;
	}
	else if ( "none".equals( lockMode ) ) {
		return LockMode.NONE;
	}
	else if ( "upgrade".equals( lockMode ) ) {
		return LockMode.UPGRADE;
	}
	else if ( "upgrade-nowait".equals( lockMode ) ) {
		return LockMode.UPGRADE_NOWAIT;
	}
	else if ( "upgrade-skiplocked".equals( lockMode )) {
		return LockMode.UPGRADE_SKIPLOCKED;
	}
	else if ( "write".equals( lockMode ) ) {
		return LockMode.WRITE;
	}
	else if ( "force".equals( lockMode ) ) {
		return LockMode.FORCE;
	}
	else if ( "optimistic".equals( lockMode ) ) {
		return LockMode.OPTIMISTIC;
	}
	else if ( "optimistic_force_increment".equals( lockMode ) ) {
		return LockMode.OPTIMISTIC_FORCE_INCREMENT;
	}
	else if ( "pessimistic_read".equals( lockMode ) ) {
		return LockMode.PESSIMISTIC_READ;
	}
	else if ( "pessimistic_write".equals( lockMode ) ) {
		return LockMode.PESSIMISTIC_WRITE;
	}
	else if ( "pessimistic_force_increment".equals( lockMode ) ) {
		return LockMode.PESSIMISTIC_FORCE_INCREMENT;
	}
	else {
		throw new MappingException( "unknown lockmode" );
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:41,代码来源:ResultSetMappingBinder.java


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