Skip to content

Conversation

ccorbacho
Copy link
Contributor

By swallowing the exception on failing to release a savepoint, we are hiding client code from database errors that they may need to be aware of or handle.

e.g. if the connection is now dead when trying to release the savepoint, by swallowing the exception here, client code has no way of knowing this now until the next operation on the database, which will yield a confusing message about the problem and obscures where the failure occurred as it will be in a different part of their code that throws any exception.

Swallowing the exception here is also inconsistent with all the other database calls in the Transaction Object, where we always raise an exception up and let client code decide how to handle the error.

By swallowing the exception on failing to release a savepoint, we are hiding
client code from database errors that they may need to be aware of or handle.

e.g. if the connection is now dead when trying to release the savepoint, by
swallowing the exception here, client code has no way of knowing this now until
the next operation on the database, which will yield a confusing message about
the problem and obscures where the failure occurred as it will be in a different
part of their code that throws any exception.

Swallowing the exception here is also inconsistent with all the other database
calls in the Transaction Object, where we always raise an exception up and let
client code decide how to handle the error.
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Jun 9, 2024
@jhoeller jhoeller self-assigned this Jun 9, 2024
@jhoeller jhoeller added in: data Issues in data modules (jdbc, orm, oxm, tx) type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Jun 9, 2024
@jhoeller jhoeller added this to the 6.2.0-M4 milestone Jun 9, 2024
@jhoeller jhoeller merged commit e95e442 into spring-projects:main Jun 9, 2024
@jhoeller
Copy link
Contributor

jhoeller commented Jun 9, 2024

releaseSavepoint has a bit of a double role in serving as a sort-of commit as well as a resource cleanup step. On review, I agree that propagating the exceptions makes sense, focusing on the commit-like role rather than the cleanup role. This may have side effects in certain scenarios so it seems like a fine change worth trying in 6.2, along with #30509. Thanks for raising this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

in: data Issues in data modules (jdbc, orm, oxm, tx) type: enhancement A general enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants