目标状态不是请求的接口org.neo4j.graphdb.node而是null



我在玩neo4j时遇到了一些困难。首先,当我尝试删除定义@EntityModel时,我会得到一个例外(请原谅我的照片质量,例外消息也存在问题标题):

My Controller (this is just for testing purpouse):
@Controller
public class HomeController {
@Autowired
PersonRepository personRepository;
@RequestMapping(value="/", method = RequestMethod.GET)
public String loadPage(final Model model, final HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) {
    Person person = new Person("My person");
    personRepository.save(person);
    personRepository.findOne(person.getId());
    return "home";
}
}

和模型:

@NodeEntity
public class Person {
@GraphId
private Long id;
private String name;
public Person() {}
public Person(String name) {
     this.name = name;
}
public String getName() {
    return name;
}
public void setName(final String name) {
    this.name = name;
}
public Long getId() {
    return id;
}
}

配置文件:

 @Configuration
 @EnableTransactionManagement
 @EnableNeo4jRepositories(basePackages = "com.springapp.mvc.repository")
 @ComponentScan({"com.springapp.mvc"})
 public class PersistenceConfig extends Neo4jConfiguration {
@Bean
public GraphDatabaseService graphDatabaseService() {
    return new SpringRestGraphDatabase("http://localhost:7474/db/data");
}
}

我的存储库:

public interface PersonRepository extends GraphRepository<Person> {
@Query("MATCH (n:Person{name: "{namveValue}"}) RETURN n;")
Person findByName(@Param("nameValue") final String name);
}

我在做什么错?我发现也许人们应该实现org.neo4j.graphdb.node,这是这些例外的来源。但是,在搜索GitHub存储库后,我看到人们在模型中没有实现此界面。到目前为止,我还没有在Stackoverflow上找到解决方案。

节点存在于数据库中,但我不能将其删除或保存。请帮助。

您正在尝试查看具有ID'0'的节点是否存在。由于根节点没有" __type__"属性,因此呼叫将失败。SDN使用此属性确定节点的实体类型。

说,例外似乎是由以下行引起的:

if(! personRepository.exists(0L)) {