本文整理汇总了Java中javax.persistence.LockModeType.PESSIMISTIC_WRITE属性的典型用法代码示例。如果您正苦于以下问题:Java LockModeType.PESSIMISTIC_WRITE属性的具体用法?Java LockModeType.PESSIMISTIC_WRITE怎么用?Java LockModeType.PESSIMISTIC_WRITE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类javax.persistence.LockModeType
的用法示例。
在下文中一共展示了LockModeType.PESSIMISTIC_WRITE属性的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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 );
}
示例2: lock
/**
* 使用悲观锁
*/
public void lock() {
this.lockMode = LockModeType.PESSIMISTIC_WRITE;
}
示例3: listByState
@Lock(LockModeType.PESSIMISTIC_WRITE)
@Query("SELECT p FROM AitTaskEmailPivot p WHERE p.state = ?1 order by p.id")
List<AitTaskEmailPivot> listByState(final String state);
示例4: findLockByAppCodeAndKeyAndProfileCode
@Lock(LockModeType.PESSIMISTIC_WRITE)
PropertyValue findLockByAppCodeAndKeyAndProfileCode(String appCode, String key, String profileCode);
示例5: findLockByAppCode
@Lock(LockModeType.PESSIMISTIC_WRITE)
App findLockByAppCode(String appCode);
示例6: findLockByProfileCode
@Lock(LockModeType.PESSIMISTIC_WRITE)
Profile findLockByProfileCode(String profileCode);
示例7: findLockByAppCodeAndKey
@Lock(LockModeType.PESSIMISTIC_WRITE)
PropertyKey findLockByAppCodeAndKey(String appCode, String key);
示例8: findLockByManagerCode
@Lock(LockModeType.PESSIMISTIC_WRITE)
Manager findLockByManagerCode(String managerCode);
示例9: findLockByManagerCodeAndAppCode
@Lock(LockModeType.PESSIMISTIC_WRITE)
ManagerApp findLockByManagerCodeAndAppCode(String managerCode, String appCode);
示例10: findOneForUpdate
/**
* Zoek een gepersisteerde {@link Selectietaak selectietaak} voor een update.
* @param id het ID van de taak
* @return de selectietaak
*/
@Query("select t from Selectietaak t where id= :id")
@Lock(LockModeType.PESSIMISTIC_WRITE)
Selectietaak findOneForUpdate(@Param("id") Integer id);