【发布时间】:2021-09-21 13:05:59
【问题描述】:
我有一个类,它有其他对象作为它的成员字段。 例如:
class Orders{
private Integer code;
@OneToOne(fetch=FetchType.EAGER)
@JoinColumn(name="code", nullable=false)
private Category category;
private PaymentType pt;
}
class Category{
private Integer id;
@OneToMany(fetch=FetchType.EAGER)
@JoinColumn(name="id", nullable=false)
private Brands brand;
....
}
class Brands{
private Integer id;
private String brandName;
}
我需要获取该特定订单的所有品牌。
如何通过 Hql 中的 Orders 表只获取品牌?
【问题讨论】:
标签: java hibernate spring-mvc hql