neo4j :: Getting java.lang.IllegalArgumentException: Class class is not a valid entity class. Please check the entity mapping

Anil Kumar Source

I was trying to learn Neo4j-OGM(Version:3.1.0).But I stucked with this Exception.Even tried with older versions but no use.And googled for help but couldn't find anything.Neo4j is the only choice for my project.I don't find anything wrong with my code. Can anyone help me with this? Thanks :) Here is my code..Sorry for this lengthy question.

public class Movie {
    Long id;
    private String name;
    public Movie(String name){;
    public Movie(){}       

public class Actor  {
    private Long id;
    private String fullName;

    @Relationship(type="ACTED_IN", direction=Relationship.OUTGOING)
    private List<Role> filmography;

    public Actor(String name){
        this.filmography=new ArrayList<>();
    public Actor(){}
    public void addRole(Role r){

public class Role {
    @Id @GeneratedValue  private Long relationshipId;
    @Property            private String title;
    @StartNode           private Actor actor;
    @EndNode             private Movie movie;
    public Role(){}
    public Role(String title,Actor actor,Movie movie){;
public class Main{
   public static void main(String[] a){
        Movie m1=new Movie("M1");
        Actor a1=new Actor("A1");
        Actor a2=new Actor("A2");
        Movie m2=new Movie("M2");
        Role r1=new Role("R1",a1,m1);
        Role r2=new Role("R2",a2,m1);
        Role r3=new Role("R3",a2,m2);
        Configuration configuration = new Configuration.Builder()
            .credentials("neo4j", "admin")
        SessionFactory sessionFactory = new SessionFactory(configuration, "");
        Session session=sessionFactory.openSession();


comments powered by Disqus