title: troubleshoot hibernate exceptions
body: <p>At runtime an application (based on Java/Spring/Hibernate) throws the following exception:</p>
  
  <blockquote>
    <p>07:18:38.511 ERROR Error for batch element #1: The insert or update value of the FOREIGN KEY "SOME_FIELD.SQL_11410213222" is not equal to any value of the parent key of the parent table.. SQLCODE=-530</p>
  </blockquote>
  
  <p>The stack trace only partially helps in finding the root of the issue (here a foreign key constraint violation). </p>
  
  <p>Is there a way to also print the sql which caused this exception (or at least the parameters used in the statement)? I'm aware this can be achieved by tweaking the logging configuration but then both the statements which run fine and the statements which cause the errors will be logged. I only want to output info relevant to the erroneous statements... Is this doable ? </p>