本文整理了Java中org.hibernate.Query.getLockOptions
方法的一些代码示例,展示了Query.getLockOptions
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.getLockOptions
方法的具体详情如下:
包路径:org.hibernate.Query
类名称:Query
方法名:getLockOptions
[英]Obtains the LockOptions in effect for this query.
[中]获取对此查询有效的锁定选项。
代码示例来源:origin: hibernate/hibernate-orm
@Test
public void testHql() {
Session session = openSession();
session.beginTransaction();
Query qry = session.createQuery( "from Door" );
qry.getLockOptions().setLockMode( LockMode.PESSIMISTIC_WRITE );
qry.setFirstResult( 2 );
qry.setMaxResults( 2 );
@SuppressWarnings("unchecked") List<Door> results = qry.list();
assertEquals( 2, results.size() );
for ( Door door : results ) {
assertEquals( LockMode.PESSIMISTIC_WRITE, session.getCurrentLockMode( door ) );
}
session.getTransaction().commit();
session.close();
}
代码示例来源:origin: com.github.cafdataprocessing/corepolicy-hibernate
@Override
public LockOptions getLockOptions() {
return query.getLockOptions();
}
代码示例来源:origin: riotfamily/riot
@Override
public LockOptions getLockOptions() {
return query.getLockOptions();
}
内容来源于网络,如有侵权,请联系作者删除!