首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > Web前端 >

hibernate hql施行in语句

2012-11-25 
hibernate hql执行in语句假设ListInteger a;a里面已经有数据了,则HQL查询条件可以为:String hql from

hibernate hql执行in语句
假设List<Integer> a;a里面已经有数据了,则HQL查询条件可以为:

String hql = "from Tab o where o.id in (:id)";   Query q ;List<Integer> idList = new ArrayList<Integer>();idList.add(1);idList.add(2);q.setParameterList("id", idList); 


重点是设置参数的时候要用setParameterList
设置参数的时候,idList还可以是数组,如int[] idInt

黑色头发:http://heisetoufa.iteye.com/

热点排行