Hi
There are lots of places where there is a need for generating sequence numbers even though there is a option of generating unique ids using DB. i can think of Account Numbers in bank Accounts.
Anyway
1) one easy way is to go for synchronizing the method. - This is probably more widely used.
2) U can cache some 1000 number from database, keep updating the same in the application and then u can do a batch update, provided u are maintaining the sequence numbers in a seperate tables.
Two : To change the SELECT statement which is used to select the id from database table to SELECT .... FOR UPDATE
What will this lead to?? There is no need.