-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Labels
Milestone
Description
The commit spring-projects/spring-framework@083113d changed the way that exceptions are translated from the database exception. In some of our tests, what before was a DuplicateKeyException
now is a DataIntegrityViolationException
and we ignore the DataIntegrityViolationException
. See:
Lines 506 to 520 in abce2eb
try { | |
this.jdbcOperations.update(this.createSessionAttributeQuery, (ps) -> { | |
String attributeName = attributeNames.get(0); | |
ps.setString(1, session.primaryKey); | |
ps.setString(2, attributeName); | |
lobCreator.setBlobAsBytes(ps, 3, serialize(session.getAttribute(attributeName))); | |
}); | |
} | |
catch (DuplicateKeyException ex) { | |
throw ex; | |
} | |
catch (DataIntegrityViolationException ex) { | |
// parent record not found - we are ignoring this error because we | |
// assume that a concurrent request has removed the session | |
} |
The code should be adapted to the new behavior. It is important to note that in case of a duplicate key we should still consider throwing an exception since it is a clue to users that they need to expose a SessionRepositoryCustomizer
Bean (see #1213)