[ZODB-Dev] Commit seems to succeed but does'nt
Christian Robottom Reis
kiko@async.com.br
Wed, 26 Sep 2001 13:19:48 -0300 (BRT)
On Wed, 26 Sep 2001, Cyril Elkaim wrote:
> We have a "classic" database to implement (persons, items for each of
> them, relations between). Of course we can do that with ZODB, and, in
> fact, it's much simpler that creating SQL tables and writing wrapper
> code. Our problem is that many user can access and *modify* this
> database at the same time.
I have such a classic database implemented, and it works very well.
> If we understand correctly, if we put everything in 'root' (using mapping
> only for indexes) each time users will modify even different objects at
> the same time ZODB considers that 'root' itself is modified and raise an
> exception.
No, not if you organize your data structure correctly. Root itself will
only change if you add new members to it. What we do is use a structure as
follows:
a) Our root object points to a set of object catalogs, which are referred
to by a string name. For instance, ClientCatalog is one such catalog.
These catalogs are actually IOBTrees, but mappings would presumably work
(though would cause more invalidates when updating). So we have
root["ClientCatalog"], root["ProductCatalog"], etc.
b) Our catalogs contain many instances, indexed by an identifier that I
generate myself. I have integer ids for efficiency, but you could use
pretty much any unique identifier for your instances.
Take care,
--
Christian Reis, Senior Engineer, Async Open Source, Brazil.
http://async.com.br/~kiko/ | [+55 16] 272 3330 | NMFL