Examples of SecondaryKeyCreator


Examples of com.sleepycat.db.SecondaryKeyCreator

        SecondaryKeyMetadata secKeyMeta =
            entityMeta.getSecondaryKeys().get(keyName);
        assertNotNull(secKeyMeta);

        /* Create key creator/nullifier. */
        SecondaryKeyCreator keyCreator = new PersistKeyCreator
            (catalog, entityMeta, keyCls.getName(), secKeyMeta);

        /* Convert entity to bytes. */
        PersistEntityBinding entityBinding =
            new PersistEntityBinding(catalog, entityCls.getName(), false);
        entityBinding.objectToData(entity, dataEntry);
        entityBinding.objectToKey(entity, keyEntry);

        /* Extract secondary key bytes from entity bytes. */
        DatabaseEntry secKeyEntry = new DatabaseEntry();
        boolean isKeyPresent = keyCreator.createSecondaryKey
            (null, keyEntry, dataEntry, secKeyEntry);
        assertEquals(keyValue != null, isKeyPresent);

        /* Convert secondary key bytes back to an object. */
        PersistKeyBinding keyBinding =
View Full Code Here

Examples of com.sleepycat.je.SecondaryKeyCreator

    // 单个关键字索引表允许重复的记录
    SecondaryConfig config = new SecondaryConfig();
    config.setAllowCreate(true);
    config.setTransactional(true);
    config.setSortedDuplicates(true);
    config.setKeyCreator(new SecondaryKeyCreator() {

      public boolean createSecondaryKey(SecondaryDatabase secondary,
          DatabaseEntry key, DatabaseEntry data, DatabaseEntry result)
          throws DatabaseException {
        String name = secondary.getDatabaseName();
View Full Code Here

Examples of com.sleepycat.je.SecondaryKeyCreator

    mySecConfig.setSortedDuplicates(true);

    /*
     * Get a secondary object and set the key creator on it.
     */
    SecondaryKeyCreator firstKeyCreator = new MyFirstKeyCreator();
    mySecConfig.setKeyCreator(firstKeyCreator);
   

    firstKeyIndex = BerkeleyDBFactory.getEnv().openSecondaryDatabase(null,
        "matrix_first_key", db, mySecConfig);
   
    /*
     * Get a secondary object and set the key creator on it.
     */
    SecondaryKeyCreator secondKeyCreator = new MySecondaryKeyCreator();
    mySecConfig.setKeyCreator(secondKeyCreator);
   
    secondKeyIndex = BerkeleyDBFactory.getEnv().openSecondaryDatabase(null,
        "matrix_second_key", db, mySecConfig);
   
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.