我有下面的关系b.w两个实体,如下所示,当我从存储库中获取OutletProductVariety对象时,价格将以PersistentBag形式出现,而不是使用fetchtype Eager后的列表形式出现。
@Entity
public class OutletProductVariety {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
Long id;
@ManyToOne
@JoinColumn(name = "varietyId")
Variety variety;
@OneToMany(mappedBy = "outletVariety", fetch = FetchType.EAGER)
List<Price> price;
}
@Entity
public class Price {
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
Long Id;
@ManyToOne
@JoinColumn(name="outletVareityId")
private OutletProductVariety outletVariety;
private Double price;
}
我怎样才能得到一个价格表而不是持久包?