[英]arangodb and spring data, how can I use a user generated Id?
I'm using ArangoDB arangodb-java-driver.version=4.2.1 and arangodb-spring-data.version=1.1.2 (although will be moving to spring boot 2 soon, so these will change) 我正在使用ArangoDB arangodb-java-driver.version = 4.2.1和arangodb-spring-data.version = 1.1.2(尽管很快就会迁移到Spring Boot 2,所以这些都会改变)
I would like to be able create new objects with an id that's already generated. 我希望能够使用已经生成的ID创建新对象。
I realize this can be done using the arangoTemplate/arangoOperations ( arangoOperations.insert(doc)
) but this takes us out of spring data and pulls arango specific code into my service classes. 我意识到可以使用arangoTemplate / arangoOperations( arangoOperations.insert(doc)
)完成此操作,但是这使我们脱离了Spring数据,并将arango特定的代码拉入了我的服务类。
The issue is that if I save a new object that already contains an id (that uses the @Id annotation) then arango will assume it's an update, and fail with object-not-found (as it checks to see if the object is there before doing an update) 问题是,如果我保存一个已经包含ID(使用@Id批注)的新对象,则arango会假定它是一个更新,并且由于找不到对象而失败(因为它将检查该对象是否存在)在进行更新之前)
So ... does anyone have any bright ideas that will help me to use arangodb and spring data and provide my own IDs ? 那么...是否有人有什么聪明的主意可以帮助我使用arangodb 和 spring数据并提供自己的ID?
thanks in advance, 提前致谢,
Simon 西蒙
this is currently an issue and the only workaround I see, is to use a field annotated with @Key
and use ArangoOperations.insert(Object)
to initial save your entity. 目前这是一个问题,我看到的唯一解决方法是使用带有@Key
注释的字段,并使用ArangoOperations.insert(Object)
初始保存您的实体。
Solving this problem is on high priority. 解决此问题是当务之急。 I created a github issue to track the progress on this. 我创建了一个github问题来跟踪此进度。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.