-
Notifications
You must be signed in to change notification settings - Fork 333
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
PartTree Delete queries cause nested Spanner transaction when using @Transactional #619
Comments
@guycall Thank you for describing the issue in detail. This should, in principle, work, and all repository methods should reuse the declared transaction. @ddixit14 Can you try to reproduce this scenario (declarative |
As @guycall stated,
This line is currently not able to work with Meanwhile, So, straight workaround would be just to replace But both scenarios have to work, I believe. |
Thank you for the clarification! |
Reproduced with the spring-cloud-gcp 4.2.0
|
It's unnecessary per https://maven.apache.org/wrapper/#usage-without-binary-jar. Fixes: #614
fyi, the above 2 mentions are not related to this issue, and due to url mismatch in migrating the r2dbc module. |
Describe the bug
I am not sure if this is expected behaviour, but Spanner delete operations raise exception within methods annotated with
@Transactional
.Sample
On entering this method a transaction is created:
Creating new transaction with name [com.xxx.xxx.UpdateItem.handle]: PROPAGATION_REQUIRED,ISOLATION_DEFAULT
But executing
deleteByOwnerId
then triggers anexception:java.lang.IllegalStateException: There is already declarative transaction open
.I know Spanner does not allow nested transactions, and the docs state "The delete operation happens in a single transaction". But I wonder if this expected behaviour when using @transactional? Should the delete run inside the existing transaction?
Workaround
The workaround is to first read the entities to delete and then call
itemRepository.deleteAll(entitiesToDelete)
NB: This is using version 1.2 of spring-cloud-gcp
The text was updated successfully, but these errors were encountered: