This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I am doing registeration process there is 2 tables 1. client 2. serial (has a field with last client no.)
I want to add new client in client table , its number is last client no. +1
what i already did as follows
1. html form for user information 2. jsp confirmation page (gets data from the previous page) it access serial table and gets last client no. it has submit button that add new client to client table 3. jsp page to modify serail table with the new customer no
I am not sure what database you are using but I would recommend that use sequence (Oracle has sequence) to get the next number before you insert into the table. Sequence will always assign next available number to new request even when there are concurrent request to db at the same time. Oracle will handle that far you.
Your issue is that there could be multiple clients who can access the page that assign the next number at the same time.