-
Notifications
You must be signed in to change notification settings - Fork 38.7k
Closed
Labels
in: dataIssues in data modules (jdbc, orm, oxm, tx)Issues in data modules (jdbc, orm, oxm, tx)type: regressionA bug that is also a regressionA bug that is also a regressiontype: wiki-documentationA documentation update required on the wikiA documentation update required on the wiki
Milestone
Description
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 generic DataIntegrityViolationException
(that obviously breaks the test):
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]
Looking into the sources, I noticed that v5 instantiates a DuplicateKeyException
in SQLErrorCodeSQLExceptionTranslator
while v6 instantiates a DataIntegrityViolationException
in SQLExceptionSubclassTranslator
.
- My code: https://github.com/albertus82/simple-jdbc-filestore/blob/spring6/src/main/java/io/github/albertus82/filestore/jdbc/SimpleJdbcFileStore.java#L273
- Test: https://github.com/albertus82/simple-jdbc-filestore/blob/spring6/src/test/java/io/github/albertus82/filestore/jdbc/SimpleJdbcFileStoreTest.java#L188
- Failure log: https://github.com/albertus82/simple-jdbc-filestore/actions/runs/3492195047/jobs/5845701283#step:4:13616
Thank you.
Metadata
Metadata
Assignees
Labels
in: dataIssues in data modules (jdbc, orm, oxm, tx)Issues in data modules (jdbc, orm, oxm, tx)type: regressionA bug that is also a regressionA bug that is also a regressiontype: wiki-documentationA documentation update required on the wikiA documentation update required on the wiki