[ZODB-Dev] Setting the jar

Jim Fulton jim at zope.com
Sun Aug 14 10:21:49 EDT 2005


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
ambiguity.

Jim

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


-- 
Jim Fulton           mailto:jim at zope.com       Python Powered!
CTO                  (540) 361-1714            http://www.python.org
Zope Corporation     http://www.zope.com       http://www.zope.org


More information about the ZODB-Dev mailing list