I think this is what you are looking for: synchronize your servlet method...

you may want to create a private static int reckey variable accessible
through a public getRecCounter method (synchronized), rather than using the
natural order count, described. Natural order counts cause problems, in the
long run.

Phil

-----Original Message-----
From: Nanduri Amarnath <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
Date: Thursday, October 28, 1999 12:56 PM
Subject: Question that is puzzling me


>Guys/Girls ,
>     I am calling a servlet from a jsp. The servlet implements the
>SingleThreadModel.
>The servlet has a doPost() method that writes data to a table in the
database.
>The primary key
>for each row of this Table is got by counting the ( number of rows in the
Table
>+ 1 ).  This is done in the
>doPost() method. Also i am setting autoCommit() to false ( in the
Connection
>Object ) and doing either a
>complete commit() or a complete rollback().
>
>My question is... if different people hit this page simultaneously, will i
still
>be getting unique primary keys for every person
>(or) if not is there a better way to do it......... Thanks in advance.
>
>Cheers,
>Amar..
>
>===========================================================================
>To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
>FAQs on JSP can be found at:
> http://java.sun.com/products/jsp/faq.html
> http://www.esperanto.org.nz/jsp/jspfaq.html
>

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
FAQs on JSP can be found at:
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html

Reply via email to