[Zope] Internal reference between objects saved in ZODB gets lost?
   
    Max M
     
    maxmcorp@worldonline.dk
       
    Mon, 3 Sep 2001 21:56:44 +0200
    
    
  
If I create two objects and saves them with 'setObject' any references
between objects is lost. Is that true?
Simple stoopid non-working code example::
class test:
    def __init__(self, id, otherObject=None):
        self.id = id
        self.otherObject= otherObject
class table(ObjectManager):
    def __init__(self):
        object1 = test('1')
        object2 = test('2', object1)
        self._setObject('1')
        self._setObject('2', object2)
Do I have to save a reference to another persistent object as an
objectManager id instead?
Like this:
class test:
    def __init__(self, id, otherObject=None):
        self.id = id
        self.otherObject= otherObject
class table(ObjectManager):
    def __init__(self):
        object1 = test('1')
        object2 = test('2', '1')
        self._setObject('1')
        self._setObject('2', object2)
Saving the reference directly is so much easier. But apparantly I get into
trouble when I try to.
I could save all my data structure in a dict or somesuch structure. This
keeps the references intact. But I guess that i will get a nasty growth in
Data.fs whenever the object is changed. At least until a packing of the
database.
Something like::
    number of objects * size pr object * times changed
This could probebly be a real problem if the object had a size of 500 MBs in
all and lots of changes.
Do I understand this correctly?
regards Max M
Max M. W. Rasmussen,    Denmark.   New Media Director
private: maxmcorp@worldonline.dk work: maxm@normik.dk
-----------------------------------------------------
Shipping software is an unnatural act