Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Throw PessimisticLockingFailureException/CannotAcquireLockException instead of plain ConcurrencyFailureException #29675

Closed
jhoeller opened this issue Dec 12, 2022 · 0 comments
Assignees
Labels
in: data Issues in data modules (jdbc, orm, oxm, tx) type: enhancement A general enhancement
Milestone

Comments

@jhoeller
Copy link
Contributor

jhoeller commented Dec 12, 2022

Related to #29511 and the general default change to SQLExceptionSubclassTranslator in 6.0, it would be helpful for typical application-level handling to identify pessimistic locking cases without relying on specific subclasses such as ConcurrencyFailureException and DeadlockLoserDataAccessException.

As a consequence, SQLExceptionSubclassTranslator and SQLStateSQLExceptionTranslator should throw PessimisticLockingFailureException instead of the superclass ConcurrencyFailureException for database-level concurrency failures, more strongly differentiating such database lock consequences from OptimisticLockingFailureException at the ORM level.

Also, SQL state 40001 is commonly reported for lock acquisition failures, so we should turn that specific case into CannotAcquireLockException specifically.

The combination of the above is expected to reduce the need for DeadlockLoserDataAccessException and CannotSerializeTransactionException which are not supported by SQLException and SQL state classification. Those exception subclasses are marked as deprecated now but still thrown from corresponding SQL error code mappings (but not by default anymore).

@jhoeller jhoeller added in: data Issues in data modules (jdbc, orm, oxm, tx) type: enhancement A general enhancement labels Dec 12, 2022
@jhoeller jhoeller added this to the 6.0.3 milestone Dec 12, 2022
@jhoeller jhoeller self-assigned this Dec 12, 2022
@jhoeller jhoeller changed the title Throw PessimisticLockingFailureException instead of ConcurrencyFailureException Throw PessimisticLockingFailureException instead of plain ConcurrencyFailureException Dec 12, 2022
@jhoeller jhoeller changed the title Throw PessimisticLockingFailureException instead of plain ConcurrencyFailureException PessimisticLockingFailureException/CannotAcquireLockException instead of plain ConcurrencyFailureException Dec 12, 2022
@sbrannen sbrannen changed the title PessimisticLockingFailureException/CannotAcquireLockException instead of plain ConcurrencyFailureException Throw PessimisticLockingFailureException/CannotAcquireLockException instead of plain ConcurrencyFailureException Dec 14, 2022
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

No branches or pull requests

1 participant