Skip to content

Introduced pessimistic locks for derived queries. #720

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

Conversation

DiegoKrupitza
Copy link

Methods which use the derive query functionality now can be annotated with @Lock to used a given LockMode. Right now there are two different modes PESSIMISTIC_READ and PESSIMISTIC_WRITE. Based on the dialect the right select is generated. For example for H2 Select ... FOR UPDATE.

Closes spring-projects/spring-data-relational#1041
Related tickets #643

  • You have read the Spring Data contribution guidelines.
  • You use the code formatters provided here and have them applied to your changes. Don’t submit any formatting related changes.
  • You submit test cases (unit or integration tests) that back your changes.
  • You added yourself as author in the headers of the classes you touched. Amend the date range in the Apache license header if needed. For new types, add the license header (copy from another file and set the current year only).

Methods which use the derive query functionality now can be annotated with `@Lock` to used a given `LockMode`. Right now there are two different modes `PESSIMISTIC_READ` and `PESSIMISTIC_WRITE`. Based on the dialect the right select is generated. For example for H2 `Select ... FOR UPDATE`.

Closes spring-projects/spring-data-relational#1041
Related tickets spring-projects#643
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Feb 15, 2022
@mp911de mp911de added the status: blocked An issue that's blocked on an external project change label Feb 21, 2022
@mp911de
Copy link
Member

mp911de commented Feb 21, 2022

Thanks a lot. It makes sense to have this, but we're in the process of moving Spring Data R2DBC into Spring Data Relational (side by side with JDBC) and we need to apply some refactoring in JDBC first before we can merge this one.

@DiegoKrupitza
Copy link
Author

DiegoKrupitza commented Feb 21, 2022

Thanks a lot. It makes sense to have this, but we're in the process of moving Spring Data R2DBC into Spring Data Relational (side by side with JDBC) and we need to apply some refactoring in JDBC first before we can merge this one.

No worries! In case you have questions about the locking implementation, I am glad to help, since I also implemented the same for spring-data-JDBC.

schauder added a commit to spring-projects/spring-data-relational that referenced this pull request Feb 22, 2022
This allows both Spring Data R2DBC and Spring Data JDBC to use the same annotation.

See /issues/1041, spring-projects/spring-data-r2dbc/pull/720, /pull/1158
schauder added a commit to spring-projects/spring-data-relational that referenced this pull request Feb 22, 2022
This allows both Spring Data R2DBC and Spring Data JDBC to use the same annotation.

See /issues/1041, spring-projects/spring-data-r2dbc/pull/720, /pull/1158
schauder added a commit to spring-projects/spring-data-relational that referenced this pull request Feb 22, 2022
@schauder
Copy link
Contributor

Thanks, that's merged polished and merged into 3.0.x

@schauder schauder closed this Feb 22, 2022
@schauder schauder added type: enhancement A general enhancement and removed status: blocked An issue that's blocked on an external project change status: waiting-for-triage An issue we've not yet triaged labels Feb 22, 2022
@mp911de mp911de added this to the 3.0 M2 (2022.0.0) milestone Feb 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A general enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

API for pessimistic locks (SELECT … FOR UPDATE)
4 participants