John Poole wrote:
>
> What would be an example of a method for creating a surrogate public
> reference for an object? We're currently using a hack to access the
> primary for a "shopping cart" table that we don't want to expose user
> information for.
Anything that uniquely identifies your object will do, you just have to
make sure it's unique. I very much like UUIDs since they are guaranteed to
be unique across time and space (see
http://www.doomdark.org/doomdark/proj/jug/index.html for my favourite
implementation). A simple counter is the easiest thing to do, just make it
persistent so that it survives app restarts. Serialized timestamps,
username xor'ed with the (probably persistent) session id of a web
application might be nice..anything you can think of. Special care must be
taken in distributed settings, so that no duplicates are created. Offhand
I'd say the value can just be created in the constructor, per-class where
it's needed.
> Am I right in assuming that auto-generation only works for a single column?
Yes, when done by the database (which is the current way). We have more
strategies in mind, like UUIDs, the magic 24 bytes that are directly
supported by many databases etc. but these are not implemented yet, partly
because it needs to be usable in Modeler and that's always a real time
sink.
Holger
This archive was generated by hypermail 2.0.0 : Tue May 27 2003 - 17:18:07 EDT