@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.