> No, I am not referring to this "Primary Key Sequence Generated By Bean
> Self Cache" thread on TSS.
>
> I am referring to the pattern discussed in "EJB Design Patterns" book by
> "Floyd Marinescu".
>
> I agree that JDBC would suffice but then we need to use "SELECT MAX(COL)
> FOR UPDATE" which locks the table and if
> The transaction is a long one then it is a potential bottleneck.

no - dont do that for the reasons you indicate.  Instead use a sequence, or
other database generated number (my opinion).  given the current options,
this is my preferred choice - and you will not incur the cost of locking the
table.  (note here that a sequence is a vendor specific thing).

cheers
dim

>
> Thanks,
> Saroj
>
> -----Original Message-----
> From: Dmitri Colebatch [mailto:[EMAIL PROTECTED]]
> Sent: Friday, September 06, 2002 12:38 PM
> To: [EMAIL PROTECTED]
> Subject: Re: PK Generator
>
>
> > Hi Dmitri,
>
> Hi (o:
>
> > Pls. excuse me this off the list post.
>
> hmmmm, grrrrr... yes... well... normally, I frown on this sort of
> stuff....
> ejb-interest is good for this sort of question...
>
> but seeing as its friday afternoon and I'm in a good mood (o:
>
> > I am trying to use the Sequence Block PK Generation Strategy for my
> CMP.
>
> never heard of it by name... are you referring to this -
> http://www.theserverside.com/patterns/thread.jsp?thread_id=5285 ?
>
> > Did you use it? Any pointers??
>
> haven't used it.  I try to use database sequences where possible for
> this
> sort of thing.  JDBC3 supports pulling the retrieved value out, so ejb
> containers will soon be able to do everything in one trip to the
> database.
>
> > Any ideas?
>
> use a sequence.... most databases have some sort of support, be it real
> sequences as in oracle and postgres, or crappy auto-numbers as in db2,
> sql
> server....
>
> I generally do a query first to get the sequence nextval, and then do my
> insert.
>
> hth
> dim
>
> ps - next time, post this sort of thing to a mailing list
> ([EMAIL PROTECTED])
>
>
>
>

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to