Re: sequential numbering across more instances
Re: sequential numbering across more instances
- Subject: Re: sequential numbering across more instances
- From: Ondřej Čada <email@hidden>
- Date: Fri, 15 Aug 2008 17:03:18 +0200
Florijan,
On Aug 15, 2008, at 4:23 PM, Florijan Stamenkovic wrote:
I've just bumped into a need to maintain a sequential numbering of
database rows, which are created by more concurrent WO application
instances.
If you just need a unique identifier for a row, you could use the
primary key value easily,
I regret to say I have a very strong feeling against using PK's for
anything but PK and relationships, ever.
so I am guessing that is not what you need. So, could you elaborate
on this a bit?
Anyway, even if I wanted to use them, it would not do, for there are
items which have no numbers... Ha, thanks! Seems you just have led me
to one reason I haven't realised originally why UNIQUE would not work
quite well :) (Unless put into a table of its own, dedicated for this
task, which I at the moment have alas completely no idea whether it's
worth that or not... I think rather not?)
What kind of a sequence is it? Do the users need to provide values,
or can they be auto generated? In short, what are you trying to do?
There's an entity, say, Order, one of whose attributes is an integer
orderNumber.
Some of created orders have no number (test ones, etc.). Those which
have a number need to be numbered in a global sequence. In pseudo-
code, I need a method
class Order:EOGenericRecord { ... ... ...
void assignOrderNumber() {
// precondition: orderNumber()==null
...
...
// postcondition: orderNumber() is unique, so that all numbered
orders make a sequence 1,2,3,4,....
}
so that this method works properly from any number of application
instances.
Thanks!
---
Ondra Čada
OCSoftware: email@hidden http://www.ocs.cz
private email@hidden http://www.ocs.cz/oc
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden