title: org.springframework.dao.DataIntegrityViolationException misreporting cause?
body: <p>I'm using hibernate to insert to a mysql table on which all columns are defined as not null. It has a unique primary key and another unique index on several columns.</p>
  
  <p>I'm getting the following error:</p>
  
  <blockquote>
    <p>org.springframework.dao.DataIntegrityViolationException: Could not
    execute JDBC batch update; SQL [insert into MY_TABLE(col1, col2, col3,
    col4, ID_) values (?, ?, ?, ?, ?)]; constraint [null]</p>
  </blockquote>
  
  <p>This error is in customer logs and I can't reproduce the problem myself, so I can't put in debugging to see what the values are in the insert statement.</p>
  
  <p>My understanding is that "constraint [null]" means a "not null" constraint is being violated. However, looking at my code, I cannot see any possible way that any of the data could be null at the time of the insert, unless hibernate is trying to insert a null ID (which would be a very bad bug in hibernate and so seems unlikely).</p>
  
  <p>However, I can see how it could happen that a unique constraint is being violated. Is it possible that the message is misleading and I'm actually getting a unique key violation? Does "constraint[null]" always mean a not null constraint was violated?</p>