unique ids

0 views
Skip to first unread message

Daniel Brooks

unread,
Sep 22, 2009, 8:21:02 AM9/22/09
to webl...@googlegroups.com
This may have been asked before, but I find I'm in need of some more
information about the intended way of giving all the objects I'm storing
a unique ID. This might be purely a cl-prevelance question though.

I'm deriving my objects from cl-prevelance's object-with-id class, and
I've overridden class-id-slot-name so that weblocks can figure out the
id of the objects I'm storing and retrieving. However, everything has an
id of -1, which is obviously wrong. Has anyone seen this before? Am I
skipping a step? From what I could tell, cl-prevelance should be doing
all the work for me, keeping the next available id stored in it's
database somewhere, but it doesn't seem to be doing so.

db48x

Leslie P. Polzer

unread,
Sep 22, 2009, 10:40:54 AM9/22/09
to webl...@googlegroups.com

From the Prevalence sources:

(defclass object-with-id ()
((id :reader get-id :initarg :id :initform -1))
(:documentation "Superclass for objects with an id"))

Weblocks assigns an uid when you call PERSIST-OBJECT.

Leslie

Daniel Brooks

unread,
Sep 22, 2009, 8:00:14 PM9/22/09
to webl...@googlegroups.com

And apparently the form view is calling that from
update-object-view-from-request, right? The objects are certainly being
persisted; any new objects that I try to create end up overwriting the
first (because they have the same id.)

db48x

Leslie P. Polzer

unread,
Sep 23, 2009, 4:19:04 AM9/23/09
to webl...@googlegroups.com

Daniel Brooks wrote:

> And apparently the form view is calling that from
> update-object-view-from-request, right? The objects are certainly being
> persisted; any new objects that I try to create end up overwriting the
> first (because they have the same id.)

I've looked at the code.

You can't use object-with-id with Weblocks-Prevalence because
it initializes the id slot with -1. Use your own object-with-id
class that initializes the slot with NIL or doesn't bind it at all.

Daniel Brooks

unread,
Sep 23, 2009, 10:41:43 AM9/23/09
to webl...@googlegroups.com
"Leslie P. Polzer" <s...@viridian-project.de> writes:

Ah, ok. This should be made more uniform, it seems like it works
differently for each of the storage back ends.

Thanks

db48x

Leslie P. Polzer

unread,
Sep 24, 2009, 3:47:43 AM9/24/09
to webl...@googlegroups.com

Daniel Brooks wrote:

> Ah, ok. This should be made more uniform, it seems like it works
> differently for each of the storage back ends.

I totally agree. The current store API and semantics need an
overhaul.

Reply all
Reply to author
Forward
0 new messages