2

I was wondering if there is any way to lazy-load objects with db4o? I read all the tutorial, and it seems that this functionality doesn't exist.

Let's clear my point. For example, let's say I have a House object with 50 complex fields.

House
 1) location : Country (complex object)
 2) window : Window (complex object)
 3) livingRoom : Room (complex object)
   .
   .
   .
 50) door : Door (complex object).

Let's say that, in a certain place of my program, I only need the location of the house. If I turn on the Transparent Activation mechanism of db4o, when I access the location field, the whole house object is activated, which means that all the fields are filled with values. This is silly, because all the other big and complex fields (that I will not use in this case) are uselessly and costly retrieved from the database.

It would be nice if I have a way to tell db4o to either fully activate an object or just activate certain fields of the object depending on my needs.

ouba64
  • 156
  • 4

1 Answers1

0

if I understood you correctly db4o's transparent activation should be enough to accomplish what you want providing that all of your "sub objects" also implement the Activatable interface (and of course, that you added TransparentActivationSupport to the configuration).

So in your sample when house gets activated all of its fields would become non null but would not be activated; only when you access these fields they should get activated.

Can you post the code (or a simple test) that leads you to believe all your objects are being activated?

Best

Vagaus
  • 4,174
  • 20
  • 31