Specifying Depth

When performing multi-key operations in the store, you can specify a depth of records to operate upon. That is, you can indicate whether you want to operate upon:

By default, multi-key operations operate upon the specified key and all of its children. To limit the operation to something else, such as just the key's immediate children, specify Depth.CHILDREN_ONLY to the operation's Depth parameter.

For example, suppose you were using the following keys:


Further, suppose you wanted to retrieve just these records:


Then you could do this using KVStore.multiGet() with the appropriate Depth argument.

package kvstore.basicExample;


import oracle.kv.Depth;
import oracle.kv.Key;
import oracle.kv.RequestTimeoutException;
import oracle.kv.Value;
import oracle.kv.ValueVersion;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.SortedMap;


ArrayList<String> majorComponents = new ArrayList<String>();


// Define the major and minor path components for the key

// Create the retrieval key
Key myKey = Key.createKey(majorComponents);

// Now retrieve the records. Note that we do not show the creation of 
// the kvstore handle here.

try {
    SortedMap<Key, ValueVersion> myRecords = null;

    myRecords = kvstore.multiGet(myKey,
} catch (RequestTimeoutException re) {
    // The operation was not completed within the 
    // timeout value