Json and Java - Circular Reference

后端 未结 3 996
故里飘歌
故里飘歌 2020-11-29 05:58

I\'m having and issue with the Circular reference.

I have Rest Webservices which returns objects to the front end, the issue is when I try to return objects that hav

3条回答
  •  北荒
    北荒 (楼主)
    2020-11-29 06:37

    A @JsonbTransient solved my problem to handel circular references:

    @JsonbTransient // javax.json.bind.annotation.JsonbTransient
    @ManyToOne
    @JoinColumn(name = "userId", referencedColumnName = "id", nullable = false)
    public AContainedEntity getAContainedEntity() {
           return aContainedEntity;
    }
    

提交回复
热议问题