您的位置:首页 > 数据库

hibernate查询sql简记

2014-08-19 08:46 183 查看
public List<IEnterpriseFinancing> queryIEnterpriseFinancingList1(
IEnterpriseFinancing enterpriseFinancing,String succ) throws Exception {
String sql = "select *  from I_ENTERPRISE_FINANCING where 1=1 and ISVALID='1' and DC_FINANCING_TYPE = "+enterpriseFinancing.getDcFinancingType() +" and  rownum<"+5+" order by CREATETIME";
if(succ!=null&&"".equals("succ")){
sql = "select *  from I_ENTERPRISE_FINANCING where 1=1 and ISVALID='1' and DC_FINANCING_TYPE = "+enterpriseFinancing.getDcFinancingType() +" and rownum<"+5+"  and proStatus = 1 order by CREATETIME";;
}

SQLQuery query = this.getHibernateTemplate().getSessionFactory().getCurrentSession().createSQLQuery(sql);
query.addEntity(IEnterpriseFinancing.class);
List<IEnterpriseFinancing> list = query.list();
return list;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: