[Zope] ZODB: When to use IDs when references?
Dieter Maurer
dieter@handshake.de
Fri, 24 Aug 2001 23:34:20 +0200 (CEST)
Thomas Guettler writes:
> Up to now I used relational databases. Now I don't know when it is
> better to use IDs and when to use references.
>
> Background: I write a Multiple Choice Python Product. There is a list
> of questions and a list of users. Both get combined in the "result"
> class. Should the class "result" have references to the questions or
> store the question-IDs?
Ids (or paths) will give you fewer hasles...
References (understood as direct object references)
can only be handled in External Methods and Python products.
Even there, they are difficult:
* you can not store "wrapped" objects in the ZODB, i.e. you
need to use "aq_base" before you store them
* when they are fetched, the appear at the new place in
the site hierarchy not the original place.
Dieter