0

I'm having some problems storing a change to a complex object. I've done a lot of digging and can't figure this out for the life of me.

From debugging, I can clearly see that the object is correct before storing, but when I retrieve the stored data, it's empty(say the increase of a stat). Specifically here is the breakdown below

StatSheet has ArrayList of Players Player has ArrayList of Stats

ArrayList of StatSheets -> ArrayList of Players -> ArrayList of Stats The ArrayList of Stat objects doesn't store after a change is made, no matter what I do. The arraylist of players seems to update fine which confuses me. I have tried changing the update depth to 2, 3, 4, 5, and beyond. I have also tried specifically setting cascadeOnUpdate to true. Can someone please help, I've been at this for days.

2 Answers2

0

It's been a while that I looked at db4o and you didn't give a lot of details about your environment or code but maybe you can look at these solutions:

  • Do you use web environment? So look at this first answer:

    A few questions about working with db4o

  • Do you use 'commit' when you store your objects? Because after storing and updating process you should commit the changes.

Community
  • 1
  • 1
Erwarth
  • 547
  • 6
  • 18
  • I am not using a web environment. I am developing on Android, however. Also, I wasn't using commit before, I've added it in but still am having the same issue.. :( – logan_izer10 Aug 01 '14 at 19:01
0

The array list of objects is store but db4o don't know what to do with the inner objects. The ArrayList isn't 'Activatable', so you can't retrieve yours objects. You must put activationPurpose on every getter/setter of your stored object to enable the activation of object.

As you can't do this on native java objects, DB4O provide you some objects that have been tagged with activationPurpose on there getter/setter : like :

com.db4o.collections.ActivatableArrayList

So every java collection that should be store must be replace with it db4o equivalent (com.db4o.collections.*).

Galigator
  • 8,957
  • 2
  • 25
  • 39