Service
Criterion c1 = Restrictions.eq("diprojectId", projectId);
Criterion c2 = Restrictions.in("digroupId", groupId);
Criterion c3 = Restrictions.eq("divalid", Const_val.C_INT_VALID);
List<TbDeviceInfo> deviceInfoList = deviceInfoDao.findAvlByProIdAndGroupId(projectId, groupId, c1, c2, c3);
Dao
public List<TbDeviceInfo> findAvlByProIdAndGroupId(Integer projectId, Collection<Integer> groupId, Criterion... c)
DetachedCriteria criteria = DetachedCriteria.forClass(TbDeviceInfo.class);
for (Criterion criterion : c) {
criteria.add(criterion);
}
List<TbDeviceInfo> results = getHibernateTemplate().findByCriteria(criteria);
分享到:
相关推荐
DetachedCriteria的查询方式汇总
NULL 博文链接:https://chaoyi.iteye.com/blog/2152094
DetachedCriteria
DetachedCriteria使用介绍
DetachedCriteria Criteria 使用方法 非常详细外加练习
Hibernate - DetachedCriteria 的完整用法文档描述
下面小编就为大家带来一篇浅谈DetachedCriteria和Criteria的使用方法(必看)。小编觉得挺不错的,现在就分享给大家,也给大家做个参考。一起跟随小编过来看看吧
Criteria 和 DetachedCriteria 均可使用 Criterion 和 Projection 设置查询条件。可以设置 FetchMode(联合查询抓取的模式),设置排序方式。对于 Criteria 还可以设置 FlushModel(冲刷 Session 的方式)和 ...
NULL 博文链接:https://rmn190.iteye.com/blog/379302
源文件 博文链接:https://kings008.iteye.com/blog/246773
().findByCriteria(detachedCriteria) 方法可以很方便地根据DetachedCriteria 来返回查询结 果。 DetachedCriteria 提供了 2 个静态方法 forClass(Class) 或 forEntityName(Name) 进行DetachedCriteria 实例的创建。
使用 Hibernate Criteria && DetachedCriteria Queries演示Exists Clause非常简单的项目 安装 git clone https://github.com/RameshRM/hibernate-sample.git 跑步 mvn install 这是一个maven项目,依赖项是 ...