I encountered some difficulties during playing with neo4j. Firstly, when I try to delete defined @EntityModel, I get an exception (Please, forgive me the quality of pics, the exception messages are also in question title):
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";
}
}
And model:
@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 file:
@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");
}
}
My Repository:
public interface PersonRepository extends GraphRepository<Person> {
@Query("MATCH (n:Person{name: \"{namveValue}\"}) RETURN n;")
Person findByName(@Param("nameValue") final String name);
}
What am I doing wrong? I figured out that perhaps Person should implement org.neo4j.graphdb.Node and this is the source of these exceptions. However, having searched github repos I see that people do not implement this interface in their models. I have not found solution on stackoverflow so far.
Node exists in database but I cannot either delete it or save it. Please, help.