2016-09-10 77 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