Hibernate的HQL中in参数设置

	@Override
	public String getElementByIds(String[] elementId) {
		String hql = "from ElementProperty  where ElementUUid in (:ElementUUid) order by ElementUUid ";
		List dataProperty = (List) getCurrentSession().createQuery(hql).setParameterList("ElementUUid", elementId)
				.list();
		if(dataProperty == null || dataProperty.size()==0){
		   	return "" ;
		}
		

 

另外一个例子

 

 

@Override
public List findDeviceTokenList(List userIdList) throws Exception {
if (userIdList == null || userIdList.isEmpty()) {
return new ArrayList(0);
}
String sql = "SELECT device_token FROM users u WHERE u.id IN (:userIdList)";
return session().createSQLQuery(sql).setParameterList("userIdList", userIdList).list();
}

Hibernate的HQL中in参数设置_第1张图片

 

 

 

 


 

你可能感兴趣的:(hibernate)