Skip to content

Using CoucbaseRepository.delete() causes @Transactional methods to error #1725

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

Closed
sf-eng opened this issue Apr 28, 2023 · 1 comment · Fixed by #1726
Closed

Using CoucbaseRepository.delete() causes @Transactional methods to error #1725

sf-eng opened this issue Apr 28, 2023 · 1 comment · Fixed by #1726
Labels
type: bug A general bug

Comments

@sf-eng
Copy link

sf-eng commented Apr 28, 2023

I'm using spring-data-couchbase 5.0.5 with spring boot 3.0.6.

When attempting to execute a service method marked @transactional which uses a CouchbaseRepository.delete call, the transaction fails with the error:
"cas must be supplied for tx remove".

I think I tracked this down to the SimpleCouchbaseRepository class's delete() implementation not supplying the .withCas() method.
To work around this I've implemented my own custom repository extension with a void deleteTx(T entity) which does employ the .withCas() method.

Is there a better supported way to use repository delete methods in @transactional blocks?

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Apr 28, 2023
@mikereiche mikereiche added status: duplicate A duplicate of another issue and removed status: waiting-for-triage An issue we've not yet triaged labels May 3, 2023
@mikereiche mikereiche reopened this May 3, 2023
@mikereiche
Copy link
Collaborator

mikereiche commented May 3, 2023

The template.deleteById(...).oneEntity(entity) works.
I'll fix delete() and deleteAll() in SimpleCouchbaseRepository, it will be in the 5.0.6 release on May 12. SimpleReactiveCouchbaseRepository already has the correct implementations.

Is there a better supported way to use repository delete methods in @transactional blocks?

Can also used lambdas...
Section 9.5 https://docs.spring.io/spring-data/couchbase/docs/current/reference/html/#couchbase.transactions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A general bug
Projects
None yet
3 participants