Best practices for handling unique constraint violation

Posted by umesh awasthi on Stack Overflow See other posts from Stack Overflow or by umesh awasthi
Published on 2011-03-13T15:59:25Z Indexed on 2011/03/13 16:10 UTC
Read the original article Hit count: 274

Filed under:
|
|

Hi All,

While working in my application i came across a situation in which there are likely chances to Unque Constraints Violation.I have following options

  1. Catch the exception and throw it back to UI
  2. At UI check for the exception and show approrpriate Error Message
  3. This is something different idea is to Check in advance about the existance of the given Unique value before starting the whole operation.

My Question is what might be the best practice to handle such situation.Currently we are using combo of Struts2+Spring 3.x+Hibernate 3.x

Thanks in advance

© Stack Overflow or respective owner

Related posts about database

Related posts about hibernate