标签:too 方式 图片 分享 title tle rom session size
String hql = "from InventoryTask it where it.orgId=:orgId"; Session session = getSession(); Query query=session.createQuery(hql); query.setString("orgId",orgId); List list = query.list(); if(list!=null&&list.size()!=0){ return (InventoryTask)list.get(0); }else{ return null; }
方式二:
String hql = "from InventoryTask it where it.orgId=?,it.orgName=?"; Session session = getSession(); Query query=session.createQuery(hql); query.setString("0",orgId); query.setString(1,orgName) List list = query.list(); if(list!=null&&list.size()!=0){ return (InventoryTask)list.get(0); }else{ return null; }
hibernate createQuery查询传递参数的两种方式
标签:too 方式 图片 分享 title tle rom session size
原文地址:https://www.cnblogs.com/lhuser/p/9017209.html