/**
* 根据searchString获取应用
* @param searchString
* @return
*/
public List<InstalledApplication> getSearchInstalledApplications(String searchString){
Query query=getSession().createQuery("from InstalledApplication i where i.appName like :str_appName or i.udid like :str_udid");
query.setParameter("str_appName", "%"+searchString+"%");
query.setParameter("str_udid", "%"+searchString+"%");
List<InstalledApplication> list=query.list();
return list;
}
需要注意的是,hql不需要在%之前或之后加上单引号'
HQL like多条件模糊查询
最新推荐文章于 2024-04-06 19:53:40 发布