Hello,
I want to check uniqueness of id at the time of entry only.And I want to give message to the user at that time only.How to do this?

Either you generate the Id and assign it to the user yourself using an autoincrement or a UUID feature, but if you want the user to select his own ID you will have to perform a check in your records (database or files) to check if the ID has already been chosen by someone else.

Either you generate the Id and assign it to the user yourself using an autoincrement or a UUID feature, but if you want the user to select his own ID you will have to perform a check in your records (database or files) to check if the ID has already been chosen by someone else.

yes.. but the problem is where should I perform this check,so that I can immediately inform user abt constraint violation.

That depends, what are you working on right now, what type of application is it ? A web page, Swing form ? You want specific answers but you haven't yet given details specific to your application.