本文整理汇总了Java中com.sleepycat.persist.PrimaryIndex.putNoOverwrite方法的典型用法代码示例。如果您正苦于以下问题:Java PrimaryIndex.putNoOverwrite方法的具体用法?Java PrimaryIndex.putNoOverwrite怎么用?Java PrimaryIndex.putNoOverwrite使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sleepycat.persist.PrimaryIndex
的用法示例。
在下文中一共展示了PrimaryIndex.putNoOverwrite方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testSharedSequence
import com.sleepycat.persist.PrimaryIndex; //导入方法依赖的package包/类
public void testSharedSequence()
throws DatabaseException {
open();
PrimaryIndex<Integer,SharedSequenceEntity1> priIndex1 =
store.getPrimaryIndex(Integer.class, SharedSequenceEntity1.class);
PrimaryIndex<Integer,SharedSequenceEntity2> priIndex2 =
store.getPrimaryIndex(Integer.class, SharedSequenceEntity2.class);
Transaction txn = txnBegin();
SharedSequenceEntity1 e1 = new SharedSequenceEntity1();
SharedSequenceEntity2 e2 = new SharedSequenceEntity2();
priIndex1.put(txn, e1);
assertEquals(1, e1.key);
priIndex2.putNoOverwrite(txn, e2);
assertEquals(Integer.valueOf(2), e2.key);
e1.key = 0;
priIndex1.putNoOverwrite(txn, e1);
assertEquals(3, e1.key);
e2.key = null;
priIndex2.put(txn, e2);
assertEquals(Integer.valueOf(4), e2.key);
txnCommit(txn);
close();
}
示例2: testSeparateSequence
import com.sleepycat.persist.PrimaryIndex; //导入方法依赖的package包/类
public void testSeparateSequence()
throws DatabaseException {
open();
PrimaryIndex<Integer,SeparateSequenceEntity1> priIndex1 =
store.getPrimaryIndex
(Integer.class, SeparateSequenceEntity1.class);
PrimaryIndex<Integer,SeparateSequenceEntity2> priIndex2 =
store.getPrimaryIndex
(Integer.class, SeparateSequenceEntity2.class);
Transaction txn = txnBegin();
SeparateSequenceEntity1 e1 = new SeparateSequenceEntity1();
SeparateSequenceEntity2 e2 = new SeparateSequenceEntity2();
priIndex1.put(txn, e1);
assertEquals(1, e1.key);
priIndex2.putNoOverwrite(txn, e2);
assertEquals(Integer.valueOf(1), e2.key);
e1.key = 0;
priIndex1.putNoOverwrite(txn, e1);
assertEquals(2, e1.key);
e2.key = null;
priIndex2.put(txn, e2);
assertEquals(Integer.valueOf(2), e2.key);
txnCommit(txn);
close();
}
示例3: testSharedSequence
import com.sleepycat.persist.PrimaryIndex; //导入方法依赖的package包/类
public void testSharedSequence()
throws DatabaseException {
open();
PrimaryIndex<Integer,SharedSequenceEntity1> priIndex1 =
store.getPrimaryIndex(Integer.class, SharedSequenceEntity1.class);
PrimaryIndex<Integer,SharedSequenceEntity2> priIndex2 =
store.getPrimaryIndex(Integer.class, SharedSequenceEntity2.class);
Transaction txn = txnBegin();
SharedSequenceEntity1 e1 = new SharedSequenceEntity1();
SharedSequenceEntity2 e2 = new SharedSequenceEntity2();
priIndex1.put(txn, e1);
assertEquals(1, e1.key);
priIndex2.putNoOverwrite(txn, e2);
assertEquals(Integer.valueOf(2), e2.key);
e1.key = 0;
priIndex1.putNoOverwrite(txn, e1);
assertEquals(3, e1.key);
e2.key = null;
priIndex2.put(txn, e2);
assertEquals(Integer.valueOf(4), e2.key);
txnCommit(txn);
close();
}
示例4: testSeparateSequence
import com.sleepycat.persist.PrimaryIndex; //导入方法依赖的package包/类
public void testSeparateSequence()
throws DatabaseException {
open();
PrimaryIndex<Integer,SeparateSequenceEntity1> priIndex1 =
store.getPrimaryIndex
(Integer.class, SeparateSequenceEntity1.class);
PrimaryIndex<Integer,SeparateSequenceEntity2> priIndex2 =
store.getPrimaryIndex
(Integer.class, SeparateSequenceEntity2.class);
Transaction txn = txnBegin();
SeparateSequenceEntity1 e1 = new SeparateSequenceEntity1();
SeparateSequenceEntity2 e2 = new SeparateSequenceEntity2();
priIndex1.put(txn, e1);
assertEquals(1, e1.key);
priIndex2.putNoOverwrite(txn, e2);
assertEquals(Integer.valueOf(1), e2.key);
e1.key = 0;
priIndex1.putNoOverwrite(txn, e1);
assertEquals(2, e1.key);
e2.key = null;
priIndex2.put(txn, e2);
assertEquals(Integer.valueOf(2), e2.key);
txnCommit(txn);
close();
}
示例5: testCompositeSequence
import com.sleepycat.persist.PrimaryIndex; //导入方法依赖的package包/类
public void testCompositeSequence()
throws DatabaseException {
open();
PrimaryIndex<CompositeSequenceEntity1.Key,CompositeSequenceEntity1>
priIndex1 =
store.getPrimaryIndex
(CompositeSequenceEntity1.Key.class,
CompositeSequenceEntity1.class);
PrimaryIndex<CompositeSequenceEntity2.Key,CompositeSequenceEntity2>
priIndex2 =
store.getPrimaryIndex
(CompositeSequenceEntity2.Key.class,
CompositeSequenceEntity2.class);
Transaction txn = txnBegin();
CompositeSequenceEntity1 e1 = new CompositeSequenceEntity1();
CompositeSequenceEntity2 e2 = new CompositeSequenceEntity2();
priIndex1.put(txn, e1);
assertEquals(1, e1.key.key);
priIndex2.putNoOverwrite(txn, e2);
assertEquals(Integer.valueOf(1), e2.key.key);
e1.key = null;
priIndex1.putNoOverwrite(txn, e1);
assertEquals(2, e1.key.key);
e2.key = null;
priIndex2.put(txn, e2);
assertEquals(Integer.valueOf(2), e2.key.key);
txnCommit(txn);
EntityCursor<CompositeSequenceEntity1> c1 = priIndex1.entities();
e1 = c1.next();
assertEquals(2, e1.key.key);
e1 = c1.next();
assertEquals(1, e1.key.key);
e1 = c1.next();
assertNull(e1);
c1.close();
EntityCursor<CompositeSequenceEntity2> c2 = priIndex2.entities();
e2 = c2.next();
assertEquals(Integer.valueOf(2), e2.key.key);
e2 = c2.next();
assertEquals(Integer.valueOf(1), e2.key.key);
e2 = c2.next();
assertNull(e2);
c2.close();
close();
}