2017-07-19 116 views
0

我是neo4j新手,使用可用的示例项目SDN4大学“https://github.com/neo4j-examples/movies-java-spring-data-neo4j-4”了解。在同一个项目中添加了名为'Link'的新节点,它也与电影节点有关系。增加额外的节点,并与电影越来越以下错误关系后:春天neo4j电影的例子不能添加新节点

Tests run: 2, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 4.502 sec <<< FAILURE! - in movie.repositories.MovieRepositoryTest testFindByTitle(movie.repositories.MovieRepositoryTest) Time elapsed: 0.36 sec <<< ERROR! org.springframework.dao.InvalidDataAccessApiUsageException: Error mapping GraphModel to instance of movie.domain.Movie; nested exception is org.neo4j .ogm.exception.MappingException: Error mapping GraphModel to instance of movie.domain.Movie at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

@NodeEntity 
public class Movie{ 
    @Relationship(type = "ACTED_IN", direction = Relationship.INCOMING) 
    private List<Role> roles = new ArrayList<>(); 
    @Relationship(type = "MOVIE_LINK", direction = Relationship.INCOMING) 
    private List<Link> links = new ArrayList<>(); 
} 

@NodeEntity 
public class Link{ 
@Relationship(type = "MOVIE_LINK") 
    private Movie movie = new Movie(); 
} 

@RelationshipEntity(type = "MOVIE_LINK") 
public class MovieLink 
{ 
    public MovieLink(Movie movie, Link link){ 
    super(); 
    this.movie = movie; 
    this.link = link; 
} 

回答

1

类两个节点和关系的实体必须有一个无参数的公共构造这样OGM可以实例化的实体。