2017-07-19 60 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可以實例化的實體。