Java Spring-data-neo4j+@查询引发PropertyReferenceException

Java Spring-data-neo4j+@查询引发PropertyReferenceException,java,spring,neo4j,spring-data-neo4j,Java,Spring,Neo4j,Spring Data Neo4j,我的域类有以下存储库: public interface IDomainRepository extends GraphRepository<Domain>, RelationshipOperationsRepository<Domain>{ //cause of error @Query("MATCH n WHERE id(n) = {0} SET n :{1}") public void attachLabel(Long id, String

我的
类有以下存储库:

public interface IDomainRepository extends GraphRepository<Domain>, RelationshipOperationsRepository<Domain>{
    //cause of error
    @Query("MATCH n WHERE id(n) = {0} SET n :{1}")
    public void attachLabel(Long id, String label);

}
这是我的测试用例,用于
attachLabel
方法:

@Test
    public void attachLabelSuccess(){

        Domain domain = new Domain();
        domain.setName(UUID.randomUUID().toString());
        domain.setDescription("xyz");

        domain = graphManager.create(domain);
        graphManager.attachLabel(domain, "DummyLabel");

        Domain d1 = domainRepository.findOne(domain.getId());

        //Should have [Domain, DummyLabel]
        Assert.assertEquals(2, d1.getLabels().size());
    }
我得到以下异常,当我运行测试时,它在加载ApplicationContext时失败:

Caused by: org.springframework.beans.factory.BeanCreationException: 
Error creating bean with name 'IDomainRepository': 
Invocation of init method failed; nested exception is org.springframework.data.mapping.PropertyReferenceException: 
No property attach found for type Domain!
...
Caused by: org.springframework.data.mapping.PropertyReferenceException: 
No property attach found for type Domain!
at org.springframework.data.mapping.PropertyPath.<init>(PropertyPath.java:75)
at org.springframework.data.mapping.PropertyPath.create(PropertyPath.java:327)
at org.springframework.data.mapping.PropertyPath.create(PropertyPath.java:359)
at org.springframework.data.mapping.PropertyPath.create(PropertyPath.java:307)
at org.springframework.data.mapping.PropertyPath.from(PropertyPath.java:270)
at org.springframework.data.mapping.PropertyPath.from(PropertyPath.java:241)
原因:org.springframework.beans.factory.BeanCreationException:
创建名为“IDomainRepository”的bean时出错:
调用init方法失败;嵌套异常为org.springframework.data.mapping.PropertyReferenceException:
未找到类型域的属性附加!
...
原因:org.springframework.data.mapping.PropertyReferenceException:
未找到类型域的属性附加!
位于org.springframework.data.mapping.PropertyPath.(PropertyPath.java:75)
位于org.springframework.data.mapping.PropertyPath.create(PropertyPath.java:327)
位于org.springframework.data.mapping.PropertyPath.create(PropertyPath.java:359)
位于org.springframework.data.mapping.PropertyPath.create(PropertyPath.java:307)
位于org.springframework.data.mapping.PropertyPath.from(PropertyPath.java:270)
位于org.springframework.data.mapping.PropertyPath.from(PropertyPath.java:241)
似乎SDN正试图以某种方式将
attachLabel
(attach)的第一部分映射到
类的属性。我试图重命名该方法,但仍然出现错误

配置:Sprind-Data-Neo4j版本3.1.1.RELEASE,Neo4j版本2.1.2

固定的
问题是,我无意中使用了mongodb名称空间中的@Query注释,而不是od neo4j。

您不能用Cypher中的参数更新标签。不幸的是,这是不可能的


因此,您必须构造查询并通过neo4jTemplate运行它。

是的,我注意到了这一点,并且已经按照您建议的方式解决了它。我还注意到有@Labels注释(planned)用于管理标签。什么时候会得到支持?
Caused by: org.springframework.beans.factory.BeanCreationException: 
Error creating bean with name 'IDomainRepository': 
Invocation of init method failed; nested exception is org.springframework.data.mapping.PropertyReferenceException: 
No property attach found for type Domain!
...
Caused by: org.springframework.data.mapping.PropertyReferenceException: 
No property attach found for type Domain!
at org.springframework.data.mapping.PropertyPath.<init>(PropertyPath.java:75)
at org.springframework.data.mapping.PropertyPath.create(PropertyPath.java:327)
at org.springframework.data.mapping.PropertyPath.create(PropertyPath.java:359)
at org.springframework.data.mapping.PropertyPath.create(PropertyPath.java:307)
at org.springframework.data.mapping.PropertyPath.from(PropertyPath.java:270)
at org.springframework.data.mapping.PropertyPath.from(PropertyPath.java:241)