Hi, I just upgraded from 5.3.24 to 6.0.0 and noticed a different behaviour of Spring JDBC/TX. I have a class containing simple JDBC statements executed with JdbcTemplate (no JPA, no ORMs), and I wrote some test cases based on H2.
org.springframework.dao.DataIntegrityViolationException: PreparedStatementCallback; SQL [INSERT INTO "STORAGE" (filename, last_modified, compressed, file_contents) VALUES (?, ?, ?, ?)]; Unique index or primary key violation: "PUBLIC.PRIMARY_KEY_B ON PUBLIC.STORAGE(FILENAME) VALUES ( /* 1 */ 'myfile.txt' )"; SQL statement:
INSERT INTO "STORAGE" (filename, last_modified, compressed, file_contents) VALUES (?, ?, ?, ?) [23505-214]
Thank you.
Affects: 6.0.0
Hi, I just upgraded from 5.3.24 to 6.0.0 and noticed a different behaviour of Spring JDBC/TX. I have a class containing simple JDBC statements executed with
JdbcTemplate(no JPA, no ORMs), and I wrote some test cases based on H2.In case of duplicate key errors, I expect
DuplicateKeyException, but after the upgrade I'm getting a more genericDataIntegrityViolationException(that obviously breaks the test):Looking into the sources, I noticed that v5 instantiates a
DuplicateKeyExceptioninSQLErrorCodeSQLExceptionTranslatorwhile v6 instantiates aDataIntegrityViolationExceptioninSQLExceptionSubclassTranslator.Thank you.