0

嗨,我已经下载了 spring data neo4j 的一个示例代码。我面临以下错误,有人可以帮忙吗?

代码片段:

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

应用程序.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

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

4

1 回答 1

0

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

于 2014-05-21T13:29:27.600 回答