I'm getting org.neo4j.ogm.metadata.MappingException: Infinite recursion (StackOverflowError) while performing a repository query. The project was ported from SDN 3.
Sample domain models:
@NodeEntity
public class Person {
...
@Relationship(type = "FRIENDSHIP")
private Set<Friendship> friendships = new HashSet<Friendship>();
...
}
@RelationshipEntity
public class Friendship {
...
@StartNode private Person person1;
@EndNode private Person person2;
Date since;
...
}
The exception is thrown when the following query is run:
@Query("MATCH (person1 {id: {0}.id})-[rel:FRIENDSHIP]->(person2 {id: {1}.id}) "
+ "return rel")
Friendship getFriendship(Person person1, Person person2);
Exception:
org.neo4j.ogm.metadata.MappingException: Infinite recursion (StackOverflowError) (through reference chain: com.example.domain.Friendship["person1StartNode"]->com.example.domain.Person["friendships"]->java.util.HashSet[0]->com.example.domain.Friendship["niperson1StartNode"]->com.example.domain.Person["friendships"]......
I thought this might be to do with @StartNode and @EndNode being the same type. But I got the same exception when @EndNode was of some other type.
Working with snapshots.