I have multiple clients working at the same time on the same database. i am strong an user information into the database. the primary key is auto generated in the database table. There is no unique column in the user table. I am storing the user information using jdbc and immediately i am fetching the max number of the primary key column and using that as the primary key for the user that i just stored. I see a problem in this. when multiple clients are working at the same time if one client stored the user info and then another client stored the user info, now if first client fetches the max number of the primary key column it gives the primary key of the user that was stored by the second client. so in jdbc how do i get the right primary key? what should be my approach? how to do it?