好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

jpa实体@ManyToOne @OneToMany无限递归方式

jpa实体@ManyToOne @OneToMany无限递归

问题描述

Cannot call sendError() after the response has been committed

解决办法

在属性上添加注释

?

1

2

3

4

     @JsonBackReference // data to json 和 JsonIgnore一样

//    @JsonManagedReference // data to json 会被序列化

//    @JsonIgnore // 直接忽略子实体

     private Collection<ArticleEntity> articlesById;

@JsonIgnore

序列化和反序列化过程中 都会忽略这个属性

@JsonManagedReference

正常序列化 反序列化

@JsonBackReference

序列化data to json过程中 ,会忽略这个属性

@OneToMany和@ManyToOne要素

cascade

一的一方一般用: cascade = CascadeType.ALL

多的一方不用设置,默认不级联

fetch

默认是lazy还是eager啊

mappedby 或者 joinColumn

一的一方用mappedby

多的一方用joinColumn

orphanRemove

一的一方用这个: orphanRemove=true

以上为个人经验,希望能给大家一个参考,也希望大家多多支持。

原文链接:https://blog.csdn.net/JsongNeu/article/details/105233824

查看更多关于jpa实体@ManyToOne @OneToMany无限递归方式的详细内容...

  阅读:18次