Hibernate中单实体多属性的抓取
如题,其中的实体类为:
public class Product {
private Integer productId;
private ProductType productType;//所属型号
private Task task;//所属任务
private String productSn;
private String productName;
private Timestamp productTime;
private String productDemo;
private Integer productFlag;
private Set devices;//包含组件
}
想根据ID查询该实体时,同时抓取所属型号、所属任务、包含组件的属性,请大神指点HQL语句写法!
String hql = "from Product as u left join fetch u.productType____________ where u.productId ="+id;
不知道这里的空怎么写,求指点.
------解决方案--------------------hibernate 你配置好关联关系,会自动填充呀?