Lombok isn't necessarily the problem. Not understanding what it generates is.

Under the hood, @Data is essentially a combination of several Lombok annotations: @Getter, @Setter, @ToString, @EqualsAndHashCode, and @RequiredArgsConstructor.

@Getter, @Setter, and @RequiredArgsConstructor are generally not the source of this particular problem. The dangerous ones here are @ToString and @EqualsAndHashCode.

In a bidirectional relationship (@​OneToMany / @​ManyToOne), entities reference each other.

Let's use this code as an example: