有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

使用GraphRespository时spring数据neo4j示例中出现java错误

嗨,我下载了一个spring数据neo4j的示例代码。我面临以下错误,有人能帮我吗

代码段:

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

应用程序。爪哇

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) 个答案