cancel
Showing results for 
Search instead for 
Did you mean: 

How to fix it?

LeonWu
Node
@Node("Person")
@Data
public class PersonEntity {
    @Id
    @GeneratedValue
    private Long id;
    @Property(name = "name")
    private final String name;
    @Property(name = "born")
    private final Integer born;

    @Relationship(type = "FRIEND", direction = OUTGOING)
    private Set<PersonEntity> actors = new HashSet<>();

    public PersonEntity(Integer born, String name) {
        this.born = born;
        this.name = name;
    }
    //Getters omitted
}

I want to define the person entity with relationship "FRIEND".

But if I put the relationship into th person entity, it causes infinite loop.

I just want to query a person and it`s friends using the entity.

1 REPLY 1

gerrit_meier
Neo4j
Neo4j

Do you have a reproducer? This should not fail from the Spring Data Neo4j side, _but_ it might be Lombok that is messing with the equals and hashCode implementation via the _Data_ annotation and includes the PersonEntities of the map. If those are the same, it will end up in an infinite loop.