title: how to catch org.springframework.dao.DataIntegrityViolationException: Could not execute JDBC batch update
body: <p>i am trying to use hibernate in spring to do sql Queries i am able to succeed in executing queries but i am getting some errors if user gives same user id which has primary key constraint or else giving string in the parameter for int so i want to catch these exceptions and send user custom exceptions like primary key constraint exception,NullValue Exception etc. like that </p>
  
  <p>error for primary key constraint i am getting is :</p>
  
  <pre><code>org.springframework.dao.DataIntegrityViolationException: Could not execute JDBC batch update
  </code></pre>
  
  <p>so is there any way to catch exceptions depending on error so that on that specific exception i can send user my custom error message . Right now i am sending user the catched exception error but user dont get what the error is so i want to send custom errors </p>
  
  <p>so is there any way to catch exceptions depending on specific error</p>