On Sun, 2007-05-27 at 16:23 -0400, Joubert Nel wrote: > Hi - > > I have a persistent class (i.e. :metaclass persistent-metaclass) defined > and am adding a whole bunch of objects that are instances of this class > to the root of my Elephant store. > > In order to retrieve a list of them I do: > (map-class fn 'my-class-name) > > 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. 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. > > I'm doing this to avoid overhead in generating more esoteric unique keys > such as UUID's. > > Are there any reasons why I should NOT use OID as the key? > > Joubert > > > > > > _______________________________________________ > elephant-devel site list > elephant-devel@common-lisp.net > http://common-lisp.net/mailman/listinfo/elephant-devel
_______________________________________________ elephant-devel site list elephant-devel@common-lisp.net http://common-lisp.net/mailman/listinfo/elephant-devel