hibernate的addEntity的用法,普通sql查询得到对象list

来源:互联网 发布:石头纹理算法 编辑:程序博客网 时间:2024/05/20 11:47
public List<SysClass> getListByTechId(int techId){
String sql = "select * from t_sys_class where id in (select classid from t_tech_teaclass where teacherid = ?)";
SQLQuery query = this.getSession().createSQLQuery(sql).addEntity(SysClass.class);
query.setInteger(0, techId);
return query.list();
}
0 0