使用双向Jackson Infinite递归解决方案的JSON输出错误

时间:2016-12-14 08:56:22

标签: json hibernate

baeldung blog中所述,我使用@JsonIdentityInfo解决问题(双向杰克逊无限递归)

@Entity
@Table(name = "Payment")
@JsonIdentityInfo(
    generator = ObjectIdGenerators.PropertyGenerator.class,
    property = "uuid")
public class Payment implements Serializable {
    ...
    @ManyToOne
    @JoinColumn(name = "registration", nullable = false)
    private Registration registration;
    ...
}


@Entity
@Table(name="Registration")
@JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class, property = "uuid")
public class Registration implements Serializable {
    ...
     @OneToMany(mappedBy="registration", cascade = {CascadeType.ALL}, fetch = FetchType.LAZY)
    private List<Payment> payment;
    ...
}

它有效,我没有递归错误,但JSON输出错误:

Brower Console Output

有什么问题?

0 个答案:

没有答案