2016-09-10 76 views

回答

0

假设你有一个@ RestController女巫发送数据角应用作为json和

//@JsonIgnoreProperties(value = { "category" }) 
public class Brand{ 

... 

@ManyToMany/OneToMany 
private Category category; 

... getters and setters 
} 

public class Category{ 

... 

@ManyToMany 
private Brand brand; 

... getters and setters 
} 

尝试添加@JsonIgnoreProperties(值= { “类别”})以品牌类。

因为品类和品牌,你取品牌对象,并谈到他的类别(或类别的列表)和类别之间的双向关系,与所有的品牌,再而三:)

就好像你替代想要拥有所有品牌和类别,您可以将@JsonIgnoreProperties(value = {“brand”})添加到Category.class