On Wed, 18 Oct 2000, Rickard Oberg wrote:
> > 3) How do we avoid clashing with keys generated by the DB itself or other
> > software?
> 
> By allowing the initial counter to be given. If you already have a bunch of
> keys in the db then simply set the initial one to a number higher than
> what's already created.

        I disagree.  I don't think we should assume that jBoss is the only
user of the database.  In general, I think we have to assume that other
apps may be updating at the same time, and even triggers within the DB and
so on.
        Now, with a compliant DB, we can fetch a number of values all in a
row instead of one at a time as requests come in, but I don't think that
really buys you anything.  In that case, we're not getting a range, just
calling "nextval" 10 times in a row.
        Ah - perhaps you were just talking about the non-compliant DB,
where we have to fake it by writing our own table or something.  In that
case, then you could certainly grab a bunch of IDs at once by just upping
the "last value" by 10.
        I think it would be better to do this as an MBean instead of an
EJB, though - it's really a service of the server, not a co-existing app
which has security and transaction settings and so on.  And I kind of
liked the suggestion that you just look in JNDI under "system/nextID" or
whatever and get back the next ID directly...  Saves you from dealing with
all that factory crap... :)

Aaron



--
--------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Problems?:           [EMAIL PROTECTED]

Reply via email to