本文整理了Java中javax.jdo.Transaction.setNontransactionalRead()
方法的一些代码示例,展示了Transaction.setNontransactionalRead()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Transaction.setNontransactionalRead()
方法的具体详情如下:
包路径:javax.jdo.Transaction
类名称:Transaction
方法名:setNontransactionalRead
[英]If true
, allow persistent instances to be read without a transaction active. If an implementation does not support this option, a JDOUnsupportedOptionException
is thrown.
[中]如果为true
,则允许在不激活事务的情况下读取持久实例。如果实现不支持此选项,将抛出JDOUnsupportedOptionException
。
代码示例来源:origin: tzaeschke/zoodb
private void executeQueries() {
pm = ZooJdoHelper.openDB(DB_FILE);
//set non-transactional read to 'true', but don't begin() yet.
pm.currentTransaction().setNontransactionalRead(true);
//use queries and navigation outside of a transaction:
queryForPeople();
queryForCoursesByTeacher("Albert Einstein");
// now, if we want to change something, we can open a trancaction
pm.currentTransaction().begin();
// change something here
pm.currentTransaction().commit();
pm.close();
pm = null;
}
代码示例来源:origin: tzaeschke/zoodb
@Test
public void testMultiSession3() {
//test that multi-session is not possible with non-tx-read enabled
//TODO this should be updated once non-tx read works with multiple sessions
PersistenceManager pm1 = TestTools.openPM();
PersistenceManager pm2 = TestTools.openPM();
try {
pm2.currentTransaction().setNontransactionalRead(true);
fail();
} catch (JDOFatalException e) {
}
pm1.close();
}
代码示例来源:origin: tzaeschke/zoodb
pm.currentTransaction().setNontransactionalRead(true);
q1.execute();
q2.execute();
代码示例来源:origin: tzaeschke/zoodb
pm.currentTransaction().setNontransactionalRead(true);
ex.iterator().hasNext();
代码示例来源:origin: tzaeschke/zoodb
pm = pmf.getPersistenceManager();
assertFalse(pm.currentTransaction().getNontransactionalRead());
pm.currentTransaction().setNontransactionalRead(true);
assertTrue(pm.currentTransaction().getNontransactionalRead());
pm.currentTransaction().setNontransactionalRead(false);
assertFalse(pm.currentTransaction().getNontransactionalRead());
pm.close();
pm = pmf.getPersistenceManager();
assertTrue(pm.currentTransaction().getNontransactionalRead());
pm.currentTransaction().setNontransactionalRead(false);
assertFalse(pm.currentTransaction().getNontransactionalRead());
pm.currentTransaction().setNontransactionalRead(true);
assertTrue(pm.currentTransaction().getNontransactionalRead());
pm.close();
代码示例来源:origin: tzaeschke/zoodb
pm.currentTransaction().setNontransactionalRead(false);
pm.currentTransaction().setNontransactionalRead(true);
内容来源于网络,如有侵权,请联系作者删除!