使用GraphRepository时,spring数据neo4j示例出错

时间:2013-10-04 09:35:40

标签: java neo4j spring-data-neo4j node-neo4j

您好我已经下载了一个弹簧数据neo4j的示例代码。我面临以下错误,有人可以提供帮助。

代码段:

public interface PersonRepository extends GraphRepository<Person> {
    Person findByName(String name);
    Iterable<Person> findByTeammatesName(String name);
}

Application.java

PersonRepository personRepository = ctx.getBean(PersonRepository.class);
GraphDatabase graphDatabase = ctx.getBean(GraphDatabase.class);

Transaction tx = graphDatabase.beginTx();
try {
    personRepository.save(greg);
    personRepository.save(roy);
    personRepository.save(craig);

    greg = personRepository.findByName("Greg");

    //......

    for (String name: new String[]{greg.name, roy.name, craig.name}) {
            System.out.println(personRepository.findByName(name));

错误:

The return types are incompatible for the inherited methods PagingAndSortingRepository<Person,Long>.findAll(Sort), CRUDRepository<Person>.findAll(Sort) PersonRepository.java   /SpringDataForNeo4j/src line 5  Java Problem
The return types are incompatible for the inherited methods Repository<Person,Long>.count(), CRUDRepository<Person>.count() PersonRepository.java   /SpringDataForNeo4j/src line 5  Java Problem
The return types are incompatible for the inherited methods Repository<Person,Long>.findAll(), CRUDRepository<Person>.findAll() PersonRepository.java   /SpringDataForNeo4j/src line 5  Java Problem

有人可以帮我解决这个问题。

1 个答案:

答案 0 :(得分:0)

我通过更新这些罐子解决了这个问题: ( spring-data-commons spring-data-commons-core )到他们的最新版本。 无论如何,我认为这是一个库问题。转到http://mvnrepository.com/artifact/org.springframework.data获取最新的罐子。