没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)
![application/x-rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
一、参数在HQL语句中直接通过模版查询(hibernate3.1.3以上版本汉字参数不乱码)
public List findPerson()
{
String hql =
" from syidt.modules.grp.basegrp.persistence.Person as person where person.personName ='李景涛' order by person.theGroup.groupOID,person.number";
List list = hibernateOperations.find(hql);
return list;
}
二、通过模版查询,通过占位府?查询 groupOID 可以为数组
public String getDutyManOfGroup(String groupOID)
{
String sql = "from syidt.modules.grp.basegrp.persistence.Person as person where person.theGroup.groupOID=?";
List list = hibernateOperations.find(sql, groupOID);
// String[] strtemp = {"1", "2"};
Iterator ite = list.iterator();
String personOID = ( (Person) ite.next()).getPersonOID();
return personOID;
}
三、DetachedCriteria查询
/**
* 部门中最大的序号数
* getGroupMaxSeq
public List findPerson()
{
String hql =
" from syidt.modules.grp.basegrp.persistence.Person as person where person.personName ='李景涛' order by person.theGroup.groupOID,person.number";
List list = hibernateOperations.find(hql);
return list;
}
二、通过模版查询,通过占位府?查询 groupOID 可以为数组
public String getDutyManOfGroup(String groupOID)
{
String sql = "from syidt.modules.grp.basegrp.persistence.Person as person where person.theGroup.groupOID=?";
List list = hibernateOperations.find(sql, groupOID);
// String[] strtemp = {"1", "2"};
Iterator ite = list.iterator();
String personOID = ( (Person) ite.next()).getPersonOID();
return personOID;
}
三、DetachedCriteria查询
/**
* 部门中最大的序号数
* getGroupMaxSeq
*
* @author chenxs
*
* @param parentGropuOID String
* @return int
*/
public int getGroupMaxSeq(String parentGropuOID)
{
DetachedCriteria detachedCriteria = DetachedCriteria.forClass(Group.class);
detachedCriteria.add(Restrictions.eq("theParentGroup.groupOID",
parentGropuOID));
detachedCriteria.setProjection(Projections.projectionList().add(
Projections.max("groupOrder")));
Integer integer = new Integer(0);
integer = (Integer) hibernateOperations.findByCriteria(
detachedCriteria).get(0);
if (integer == null) {
return 0;
}
return integer.intValue();
}
四、hibernate回调查询
/**
* downAllGroup
* 部门序列号批量下移
* =========================
*
* @author chenxs
*
* @param parentGropuOID String
* @return int
*/
public int getGroupMaxSeq(String parentGropuOID)
{
DetachedCriteria detachedCriteria = DetachedCriteria.forClass(Group.class);
detachedCriteria.add(Restrictions.eq("theParentGroup.groupOID",
parentGropuOID));
detachedCriteria.setProjection(Projections.projectionList().add(
Projections.max("groupOrder")));
Integer integer = new Integer(0);
integer = (Integer) hibernateOperations.findByCriteria(
detachedCriteria).get(0);
if (integer == null) {
return 0;
}
return integer.intValue();
}
四、hibernate回调查询
/**
* downAllGroup
* 部门序列号批量下移
* =========================
*
剩余5页未读,继续阅读
资源评论
![avatar-default](https://csdnimg.cn/release/downloadcmsfe/public/img/lazyLogo2.1882d7f4.png)
- iezhen2014-03-10hibernate hql各类查询范例不够全
![avatar](https://profile-avatar.csdnimg.cn/default.jpg!1)
jfheng
- 粉丝: 2
- 资源: 11
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助
![voice](https://csdnimg.cn/release/downloadcmsfe/public/img/voice.245cc511.png)
![center-task](https://csdnimg.cn/release/downloadcmsfe/public/img/center-task.c2eda91a.png)
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
![feedback](https://img-home.csdnimg.cn/images/20220527035711.png)
![feedback](https://img-home.csdnimg.cn/images/20220527035711.png)
![feedback-tip](https://img-home.csdnimg.cn/images/20220527035111.png)
安全验证
文档复制为VIP权益,开通VIP直接复制
![dialog-icon](https://csdnimg.cn/release/downloadcmsfe/public/img/green-success.6a4acb44.png)