[英]Can't delete Node with Cypher
i am working on Spring Data Neo4j and use Cypher-Language for some Queries. 我正在研究Spring Data Neo4j,并使用Cypher-Language进行某些查询。 Works fine so long, but delete a Node don't work.
很长一段时间都可以正常工作,但是删除节点无效。
For Example: 例如:
@Query("start u=node(5) delete u")
void deleteNode();
i use the dependencies 我用依赖
<dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j-cypher</artifactId>
<version>1.6.2</version>
</dependency>
<dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j-kernel</artifactId>
<version>1.6.2</version>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-neo4j</artifactId>
<version>2.0.1.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-neo4j-rest</artifactId>
<version>2.0.1.RELEASE</version>
</dependency>
i cannot use version 1.7.2 of Cypher because it conflict with spring data neo4j and the kernel 1.6. 我不能使用Cypher的1.7.2版本,因为它与spring数据neo4j和内核1.6冲突。
Can anybody help me? 有谁能够帮助我?
i don't want to delete a Node with 我不想删除一个节点
repository.delete(5);
Because i also want to delete Relationships and any more. 因为我也想删除关系等等。
Thx! 谢谢!
I think you should delete the relationship with the node you want to delete. 我认为您应该删除与要删除的节点的关系。 @Query("start u=node(5) delete u")
@Query(“开始u = node(5)删除u”)
If you want to delete a node ,you should confirm the node haven't relationship with other node. 如果要删除一个节点,则应确认该节点与其他节点没有关系。 Please have a try with following codes: @Query("start u=node(5) match u-[r]-() delete u,r")
请尝试使用以下代码:@Query(“ start u = node(5)match u- [r]-()delete u,r”)
Interesting idea, didn't try that yet b/c SDN still officially points to Neo4j 1.7 but that will change soon. 有趣的想法,还没有尝试过,b / c SDN仍然正式指向Neo4j 1.7,但是很快就会改变。
Why can't you update to SDN 2.1.RC2 ? 为什么不能更新到SDN 2.1.RC2?
SDN 2.0.1 doesn't work with Neo4j 1.8 as there were API changes in Neo4j. SDN 2.0.1不适用于Neo4j 1.8,因为Neo4j中的API有所更改。
You will need to add @Transactional
to the method as well. 您还需要将
@Transactional
添加到方法中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.