[code="java"]
public class HrTrainType implements java.io.Serializable {
private Set hrTrainActivities = new HashSet();
}
[/code]
[code="java"]
public class HrTrainActivity implements java.io.Serializable {
private HrTrainType hrTrainType;
}
[/code]
我的hql是
[code="java"]
String hql = "from HrTrainActivity where HrTrainType= " + channelId;
[/code]
报错了。
改为
[code="java"]
String hql = "from HrTrainActivity where HrTrainType.id= " + channelId;
[/code]
也一样报错。hql是根据对象查询,第二条语句应该是错误的。
我知道了HrTrainType的id是3,怎么根据3查出HrTrainActivity 的外键channelId是3的全部数据呢?