简体   繁体   English

Spring 数据共享 2.7.3 在使用 save() 时不更新

[英]Spring data commons 2.7.3 doesn't update when using save()

I have recently upgraded my project to java 17 and spring boot 2.7.4 and spring cloud 2021.0.4.我最近将我的项目升级到 java 17 和 spring boot 2.7.4 和 spring cloud 2021.0.4。 I am using mavenBom for spring cloud dependency management.我正在使用 mavenBom 进行 spring 云依赖管理。 It has brought in spring-data-commons-2.7.3.它引入了 spring-data-commons-2.7.3。

With the upgrade, the CRUD repository's save() doesn't seem to be updating the existing objects.随着升级,CRUD 存储库的 save() 似乎没有更新现有对象。 I am getting a duplicate key exception.我收到重复键异常。 ( org.springframework.dao.DuplicateKeyException: Document with the given id already exists ). 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.能否请你帮忙。

auto-upsert is not supported by spring-data-couchbase v 4.4.3. spring-data-couchbase v 4.4.3 不支持自动更新。

If you want to use upsert() on an entiy class that has an @Version property, you'll need to explicitly use template.upsertById() or introduce your own repository.upsert() method.如果要在具有 @Version 属性的实体 class 上使用 upsert(),则需要显式使用 template.upsertById() 或引入您自己的 repository.upsert() 方法。 Or override the repository.save() method.或者覆盖 repository.save() 方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM