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


Java PrimaryIndex.putNoOverwrite方法代码示例

本文整理汇总了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();
}
 
开发者ID:nologic,项目名称:nabs,代码行数:29,代码来源:OperationTest.java

示例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();
}
 
开发者ID:nologic,项目名称:nabs,代码行数:31,代码来源:OperationTest.java

示例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();
}
 
开发者ID:nologic,项目名称:nabs,代码行数:29,代码来源:OperationTest.java

示例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();
}
 
开发者ID:nologic,项目名称:nabs,代码行数:31,代码来源:OperationTest.java

示例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();
}
 
开发者ID:nologic,项目名称:nabs,代码行数:53,代码来源:OperationTest.java


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