Consider am using java , struts, hibernate and oracle. How can i prevent duplicate entries stored in
database. One way is to make field as Unique . For example i am entering name "prakash" in jsp page ,
prakash is already available means how can i prevent it.
Of course, that is not going to be a 100% guaranteed mechanism. How do you prevent another process inserting duplicate data after your check but before your insert without pessimistically locking the table? And why use pessimistic locking when databases provide a mechanism already in the form of unique indexes?