views:

278

answers:

2
+3  Q: 

db4o concerns

I'm interested in using db4o as my persistence mechanism in my Desktop application but I'm concerned about a couple things.

1st concern: Accidentally clipping very complex object graphs.

Say I have a tree with a height of 10 and I fetch the root, how does it handle me storing the root object again?

From my understanding, it doesn't fetch the entire tree it fetches the first 5 referenced layers.

So.. If I make a trivial change to the root and then store it, will it clip away the nodes further down the tree, in essence deleting them.

If not.. how does it handle this?

2nd concern: Extracting subgraphs in a larger object graph

Using my tree example from above... If the database contains 1 massive tree can I query for a single node within it? Since .store was called only once, does my database think it contains only 1 "record"?

Thank you.

+1  A: 

You have to be very careful, because two things can happen: you can pull whole db into memory, or just partial graph (rest of objects will be null).
In db4o there's notion of Activator and Update depth, which can be configured upon dbv40 configuration, or when objects are fetched. Its the way you tell db40 how deep you want him to go when fetching referenced objects. Check db4o web site, there's documentation about it:
http://developer.db4o.com/Resources/view.aspx/Reference/Object_Lifecycle/Activation
http://developer.db4o.com/Resources/view.aspx/Reference/Object_Lifecycle/Update_Depth

Hrvoje
+1  A: 

DB4O's Transparent Activation should resolve most of the fears you've expressed here.

Travis Heseman