- mongodb - 在 MongoDB mapreduce 中,如何展平值对象?
- javascript - 对象传播与 Object.assign
- html - 输入类型 ="submit"Vs 按钮标签它们可以互换吗?
- sql - 使用 MongoDB 而不是 MS SQL Server 的优缺点
我想知道Jackson中@JsonManagedReference
和@JsonBackReference
的区别?
最佳答案
@JsonManagedReference is the forward part of reference – the one that gets serialized normally. @JsonBackReference is the back part of reference – it will be omitted from serialization.
所以他们真的取决于你们关系的方向
public class User {
public int id;
public String name;
@JsonBackReference
public List<Item> userItems;
}
public class Item {
public int id;
public String itemName;
@JsonManagedReference
public User owner;
}
关于java - JsonManagedReference 与 JsonBackReference,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31319358/
我正在尝试找到一种根据我从关联存储库引用的实体来交换 @JsonBackRefence 和 @JsonManagedReference 的方法。 Site.java @Entity @Table(na
我有两个对象:UserEntity 和 ApartmentEntity,它们以 OneToMany 方式关联(一个用户可以拥有多个公寓)。我在使用无限递归将其序列化为 JSON 时遇到问题(我使用 @
我想知道Jackson中@JsonManagedReference和@JsonBackReference的区别? 最佳答案 @JsonManagedReference is the forward p
我正在尝试保留一个具有内部列表的对象。我必须用 @JsonManagedReference 注释实体 Item和 ItemProperty 与 @JsonBackReference,以避免无限循环 -
我正在将 Mysql 与 Java Spring Boot 应用程序和 JPA 一起使用。我在两个表(bean)之间有一对一的关系,如下所示: @JsonManagedReference @OneTo
非常感谢您解释我的问题。 我有 2 个实体和 1 个桥接表实体, 假设他们是团队、用户和团队用户。 团队实体: @Id @GeneratedValue(strategy = Gener
非常感谢您解释我的问题。 我有 2 个实体和 1 个桥接表实体, 假设他们是团队、用户和团队用户。 团队实体: @Id @GeneratedValue(strategy = Gener
回答 我将解决有关此博客的问题 Jackson – Bidirectional Relationships 谢谢你。 更新2 问题与 JsonBackReference 和 JsonManagedRe
我知道@JsonIgnore和@JsonManagedReference,@JsonBackReference都是用来解决无限递归(StackOverflowError)的 code>,这两者有什么区
我有来自用户和角色的关系,其中角色具有“一对多”关系,而用户与“role_id”列具有“多对一”关系 当我在 Spring Boot 上使用关系时,当我使用 @OneToMany 和 @ManyToO
为了避免无限递归,我使用 @JsonManagedReference 和 @JsonBackReference 。但是在检索结果时,我只能以一种方式获得预期结果。 @ManyToMany(ca
我正在使用 Spring Boot 编写 OneToMany 关系,一个属性可以有多个 propertySale。 这是我的属性类: @Data @Getter @Entity @Table(name
我读过了 http://vard-lokkur.blogspot.com/2010/10/json-jackson-to-rescue.html http://vard-lokkur.blogspot
我是一名优秀的程序员,十分优秀!