org.springframework.data.neo4j.mapping.InvalidEntityTypeException: Type class java.lang.String is neither a @NodeEntity nor a @RelationshipEntity

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • When attempting .equals() on instance of @NodeEntity annotated class against instance of some non-@NodeEntity annotated class an exception is thrown. In my opinion it should just return false with no exceptions. @NodeEntity public class Person { ... } Person person = ....;// some loading from the Graph database person.equals("some string here"); //throws the exception Exception in thread "main" org.springframework.data.neo4j.mapping.InvalidEntityTypeException: Type class java.lang.String is neither a @NodeEntity nor a @RelationshipEntity at org.springframework.data.neo4j.support.mapping.Neo4jMappingContext.createPersistentEntity(Neo4jMappingContext.java:56) at org.springframework.data.neo4j.support.mapping.Neo4jMappingContext.createPersistentEntity(Neo4jMappingContext.java:46) at org.springframework.data.mapping.context.AbstractMappingContext.addPersistentEntity(AbstractMappingContext.java:271) at org.springframework.data.neo4j.support.mapping.Neo4jMappingContext.addPersistentEntity(Neo4jMappingContext.java:61) at org.springframework.data.neo4j.support.mapping.Neo4jMappingContext.addPersistentEntity(Neo4jMappingContext.java:46) at org.springframework.data.mapping.context.AbstractMappingContext.getPersistentEntity(AbstractMappingContext.java:183) at org.springframework.data.mapping.context.AbstractMappingContext.getPersistentEntity(AbstractMappingContext.java:158) at org.springframework.data.neo4j.support.mapping.EntityStateHandler.getId(EntityStateHandler.java:82) at org.springframework.data.neo4j.support.mapping.EntityStateHandler.getPersistentState(EntityStateHandler.java:99) at org.springframework.data.neo4j.support.mapping.EntityStateHandler.equals(EntityStateHandler.java:260) at org.springframework.data.neo4j.aspects.support.node.Neo4jNodeBacking.ajc$interMethod$org_springframework_data_neo4j_aspects_support_node_Neo4jNodeBacking$org_springframework_data_neo4j_aspects_core_NodeBacked$equals(Neo4jNodeBacking.aj:235) ....
    via by Victor Cvetanov,
  • When attempting .equals() on instance of @NodeEntity annotated class against instance of some non-@NodeEntity annotated class an exception is thrown. In my opinion it should just return false with no exceptions. @NodeEntity public class Person { ... } Person person = ....;// some loading from the Graph database person.equals("some string here"); //throws the exception Exception in thread "main" org.springframework.data.neo4j.mapping.InvalidEntityTypeException: Type class java.lang.String is neither a @NodeEntity nor a @RelationshipEntity at org.springframework.data.neo4j.support.mapping.Neo4jMappingContext.createPersistentEntity(Neo4jMappingContext.java:56) at org.springframework.data.neo4j.support.mapping.Neo4jMappingContext.createPersistentEntity(Neo4jMappingContext.java:46) at org.springframework.data.mapping.context.AbstractMappingContext.addPersistentEntity(AbstractMappingContext.java:271) at org.springframework.data.neo4j.support.mapping.Neo4jMappingContext.addPersistentEntity(Neo4jMappingContext.java:61) at org.springframework.data.neo4j.support.mapping.Neo4jMappingContext.addPersistentEntity(Neo4jMappingContext.java:46) at org.springframework.data.mapping.context.AbstractMappingContext.getPersistentEntity(AbstractMappingContext.java:183) at org.springframework.data.mapping.context.AbstractMappingContext.getPersistentEntity(AbstractMappingContext.java:158) at org.springframework.data.neo4j.support.mapping.EntityStateHandler.getId(EntityStateHandler.java:82) at org.springframework.data.neo4j.support.mapping.EntityStateHandler.getPersistentState(EntityStateHandler.java:99) at org.springframework.data.neo4j.support.mapping.EntityStateHandler.equals(EntityStateHandler.java:260) at org.springframework.data.neo4j.aspects.support.node.Neo4jNodeBacking.ajc$interMethod$org_springframework_data_neo4j_aspects_support_node_Neo4jNodeBacking$org_springframework_data_neo4j_aspects_core_NodeBacked$equals(Neo4jNodeBacking.aj:235) ....
    via by Victor Cvetanov,
  • SpringData/Neo4j: cannot persist relationship
    via Stack Overflow by Rolf
    ,
    • org.springframework.data.neo4j.mapping.InvalidEntityTypeException: Type class java.lang.String is neither a @NodeEntity nor a @RelationshipEntity at org.springframework.data.neo4j.support.mapping.Neo4jMappingContext.createPersistentEntity(Neo4jMappingContext.java:56) at org.springframework.data.neo4j.support.mapping.Neo4jMappingContext.createPersistentEntity(Neo4jMappingContext.java:46) at org.springframework.data.mapping.context.AbstractMappingContext.addPersistentEntity(AbstractMappingContext.java:271) at org.springframework.data.neo4j.support.mapping.Neo4jMappingContext.addPersistentEntity(Neo4jMappingContext.java:61) at org.springframework.data.neo4j.support.mapping.Neo4jMappingContext.addPersistentEntity(Neo4jMappingContext.java:46) at org.springframework.data.mapping.context.AbstractMappingContext.getPersistentEntity(AbstractMappingContext.java:183) at org.springframework.data.mapping.context.AbstractMappingContext.getPersistentEntity(AbstractMappingContext.java:158) at org.springframework.data.neo4j.support.mapping.EntityStateHandler.getId(EntityStateHandler.java:82) at org.springframework.data.neo4j.support.mapping.EntityStateHandler.getPersistentState(EntityStateHandler.java:99) at org.springframework.data.neo4j.support.mapping.EntityStateHandler.equals(EntityStateHandler.java:260) at org.springframework.data.neo4j.aspects.support.node.Neo4jNodeBacking.ajc$interMethod$org_springframework_data_neo4j_aspects_support_node_Neo4jNodeBacking$org_springframework_data_neo4j_aspects_core_NodeBacked$equals(Neo4jNodeBacking.aj:235)
    No Bugmate found.