Search code examples
javaspring-bootneo4jspring-data-neo4j

Neo4J Spring Data - warning when providing new relationship fields to an already existed node


Neo4J Spring Data gives warnings when a new relationship field to an already existing node is added. For example if I originally has this node in the database.

@Node
public class User {
    @Id
    @GeneratedValue
    private String elementId;
    
    private String firstName;
    
    @Relationship(value="HAS", direction=Relationship.Direction.OUTGOING)
    private Lis<Token> tokens;
}

I modified the class to include another new relationship.

@Node
public class User {
    @Id
    @GeneratedValue
    private String elementId;
    
    private String firstName;
    
    @Relationship(value="HAS", direction=Relationship.Direction.OUTGOING)
    private Lis<Token> tokens;

    @Relationship(value="TAKES", direction=Relationship.Direction.OUTGOING)
    private Lis<Courses> courseList;
 }

Then when the spring application is starting it prints out warning :

"One of the relationship types in your query is not available in the database, make sure you didn't misspell it or that the label is available when you run this statement in your application (the missing relationship type is: TAKES)"

This warning is printed even after I deleted the existing node in the DB and try to run the application again and creating the new node. Any help is much appreciated. Thanks.


Solution

  • According to the documentation this warning will go away I assume after you create node with the relation and start again. As the Suggestions for improvement section states, this is fine if the relationship is created in the future.