Lazy Loadng error in JSON serializer

前端 未结 5 1964
鱼传尺愫
鱼传尺愫 2020-12-21 04:01

I have such kind of @OneToOne Hibernate relationShip

public class Address implements Serializable {

    private String id;
    private String city;
    priv         


        
5条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-21 04:43

    The easiest solution: Don't serialize entities, use Value Objects.

    If that is not an option for you, make sure that the entity Object is detached.

    With JPA (2), you would use EntityManager.detach(entity), with plain Hibernate the equivalent is Session.evict(entity).

提交回复
热议问题