I just pulled master and tried your test and of course passes. I changed the not null constraint to a @NotBlank validation and it wouldn't fire for me at all in hibernate-core. I flipped the test into the c3p0 module since I knew that the validation was firing in there and I can get it to fail.
Basically the first call to the persist happens fine and the insert is added to the batch, the next persist fails due to blowing a ConstraintViolationException which isn't a SQLException (and isn't a HibernateException anymore either) and passes right thought the catch block with the abortBatch. So while the 2nd call doesn't make it to the addToBatch the first one already did.
In your case you allowed it to get to the actual execute and db persist which actually blows a SQLException so the abortBatch was called.
|