Collections Activation

For built-in db4o collections:

Java: Db4oCollection.activationDepth(activationDepth)

configures the activation depth for the objects returned from this collection. Default activation depth value for collections is 1, for hashmaps - 2.

ActivationExample.java: testCollectionDef
01public static void testCollectionDef(){ 02 storeCollection(); 03 ObjectContainer db = Db4o.openFile(Util.YAPFILENAME); 04 db.ext().configure().activationDepth(5); 05 try { 06 ObjectSet result = db.get(List.class); 07 listResult(result); 08 P2LinkedList list = (P2LinkedList)result.get(0); 09 System.out.println("Default List activation depth: " + list.activationDepth()); 10 for (int i = 0; i < list.size(); i++){ 11 System.out.println("List element: " + list.get(i)); 12 } 13 } finally { 14 db.close(); 15 } 16 }

Let's change the activation depth:

ActivationExample.java: testCollectionActivation
01public static void testCollectionActivation(){ 02 storeCollection(); 03 ObjectContainer db = Db4o.openFile(Util.YAPFILENAME); 04 db.ext().configure().activationDepth(5); 05 try { 06 ObjectSet result = db.get(List.class); 07 listResult(result); 08 P2LinkedList list = (P2LinkedList)result.get(0); 09 System.out.println("Setting list activation depth to 0 "); 10 list.activationDepth(0); 11 for (int i = 0; i < list.size(); i++){ 12 System.out.println("List element: " + list.get(i)); 13 } 14 } finally { 15 db.close(); 16 } 17 }

Specify a value less than zero to use the default activation depth configured for the ObjectContainer or for individual objects.