How to make both bidirectional hiberbate entities serialized
问题 I have 2 Entities: public class Restaurant { @OneToMany(fetch = FetchType.LAZY, mappedBy = "restaurant") private Set<Vote> votes; } and public class Vote { @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "restaurant_id", nullable = false) private Restaurant restaurant; } if I try to get both of them like that @Query("SELECT r FROM Restaurant r JOIN FETCH r.vote ") I get Infinite Recursion with Jackson JSON. So I managed to find a way to handle that: public class Restaurant {