cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

How to fix it?

@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

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.