On Sun, 2007-05-27 at 23:46, Robert L. Read wrote: > On Sun, 2007-05-27 at 16:23 -0400, Joubert Nel wrote:
<snip> > > My question is: > > Currently I'm using the OID of the object as its key when I > > (add-to-root) because this is the only slot in my class that is > > guaranteed to be unique. (from a use-case point of view I don't care > > what the key is). > I'm afraid this may betray a lack of clarity in the documentation. If > you are using a persistent-metclass, > you probably DON'T want to call add-to-root on it. Thanks for your note, Robert. You're right; the examples in the documentation seem to imply that it is usual to (add-to-root), even for persistent classes (e.g. example code on p.41). > > In general, if you are using Ian's persistent classes, there is no > reason to explicitly call add-to-root---- > I think you will find that "map-class" above let's you get to every > class instance quite easily without > calling add-to-root. > > The act calling "make-instance" on such a class is sufficient to place > the instance in the DB, I think. Thanks for confirming - I suspected as much and am now no longer doing an add-to-root of persistent objects. On another note: In my experimentation I added several objects to the root, all with the same key. All these objects get added but there is the following curiosity: - I can do a map-class to get them all, BUT - map-root will only return one key/value pair for a given key (even when there are multiple objects stored against the same key) I'm wondering whether a design decision was made to allow addition of the same key more than once? Thanks for a great library. Joubert _______________________________________________ elephant-devel site list elephant-devel@common-lisp.net http://common-lisp.net/mailman/listinfo/elephant-devel