hibernate 模糊查询及not in子查询
来源:互联网 发布:武汉数据分析 编辑:程序博客网 时间:2024/05/15 08:11
代码如下
Query query1=this.getSession().createSQLQuery(" select p.smallClassId as smallClassId,p.id as id,p.name as name,p.thumbNail as thumbNail,p.marketPrice as marketPrice,p.memberPrice as memberPrice from product p where p.name like ? and p.smallClassId= ? and p.valid=true and p.id not in (select sp.productId from special_product sp where sp.specialId =? and sp.valid=true)") .addScalar("id",StandardBasicTypes.LONG) .addScalar("thumbNail") .addScalar("marketPrice") .addScalar("memberPrice") .addScalar("name") .addScalar("smallClassId",StandardBasicTypes.LONG) .setResultTransformer(Transformers.aliasToBean(SpecialVo.class)); query1.setParameter(0, "%"+name+"%"); query1.setParameter(1, smallClassId); query1.setParameter(2, id); List<SpecialVo> specialVos1=query1.list(); for (SpecialVo s:specialVos1){ s.setIsSpecial(false); s.setQuantity(0); } specialVos.addAll(specialVos1);
本文出自 “点滴积累” 博客,请务必保留此出处http://tianxingzhe.blog.51cto.com/3390077/1678159
0 0
- hibernate 模糊查询及not in子查询
- hibernate查询(模糊查询、子查询等)
- (NOT) IN 子查询
- hibernate query 模糊查询
- Hibernate-Criteria 模糊查询
- Hibernate模糊查询参数
- Hibernate-Criteria 模糊查询
- [Hibernate]hibernateTemplate模糊查询
- Hibernate模糊查询
- Hibernate-Criteria 模糊查询
- hibernate 模糊查询
- Hibernate模糊查询
- [JAVA]Hibernate模糊查询
- hibernate HQL 模糊查询
- Hibernate中文模糊查询
- Hibernate模糊查询
- Hibernate进行模糊查询
- hibernate 4.0模糊查询
- if continue 语句
- mysql循环批量插入测试数据
- java 和 javascript中空值和字符串的比较
- 解决全站字符乱码(POST和GET中文编码问题)
- POJ 1389 Area of Simple Polygons .
- hibernate 模糊查询及not in子查询
- 909422229__降低Java垃圾回收开销的5条建议
- Jquery ajax异步提交
- fmt:formatDate的输出格式
- windows下强制杀死tomcat进程
- java.math.BigInteger cannot be cast to java.lang.Long
- sql 语句中where 1=1 1=2作用
- 强制html元素不随窗口缩小而换行
- 控制输入文本框的宽度属性size