Tim Peters wrote:
add() is a relatively new API, intended to be called "by hand" when someone
wants to force a new object to get an oid.  I'm not really clear about the
use case(s) that drove its addition, but it's not normally involved in
auto-assigning oids and/or jars.

add was originally added to support deriving hash keys from persistent
objects based on their oids (and later database names).  If we want to
use a new persistent object as a key, based on it's persistent identity,
we need to establish it's identity using add.

A newer application of add is for resolving ambiguities when a new object
if referenced from multiple databases.  If you create a new object and
reference it from multiple databases, then you'll get an error when you try
to commit the transaction because ZODB can't tell which database to assign
the object to. An application can use add before the commit to resolve this


P.S. No, I'm not back yet. :)

Jim Fulton           mailto:[EMAIL PROTECTED]       Python Powered!
CTO                  (540) 361-1714            http://www.python.org
Zope Corporation     http://www.zope.com       http://www.zope.org
For more information about ZODB, see the ZODB Wiki:

ZODB-Dev mailing list  -  ZODB-Dev@zope.org

Reply via email to