-
Notifications
You must be signed in to change notification settings - Fork 192
v2.7.3 - save() not working as expected for updates #1658
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
Comments
If you would like us to spend some time helping you to diagnose the problem, please spend some time describing it and, ideally, providing a minimal sample that reproduces the problem. |
I am using spring-data with Couchbase as the DB. My custom update method looks as below: Problem:
|
My data model looks like below:
My repository class looks like this: |
Moved into Spring Data Couchbase as the ticket relates to Couchbase and not Spring Data Commons. |
spring-data-couchbase version that I am using is 4.4.3 |
DuplicateKey can occur on insert(). If your entity object has an @Version property that is zero, insert() will be used. This is the correct/normal behavior. |
see #1277 |
@mikereiche , thanks for confirming that it needs an explicit overriding of repository methods for accommodating upsert operations. Example of the typical query I am referring to:
|
|
I have recently upgraded my project to java 17 and spring boot 2.7.4 and spring cloud 2021.0.4. I am using mavenBom for spring cloud dependency management. It has brought in spring-data-commons-2.7.3.
With the upgrade, the CRUD repository's save() doesn't seem to be updating the existing objects. I am getting a duplicate key exception. (
org.springframework.dao.DuplicateKeyException: Document with the given id already exists
). I have already tried enabling transaction management, but to no avail.Could you please help.
The text was updated successfully, but these errors were encountered: