模糊查询

  String hql  = " from JX_ExerciseDb where jdd like '%"+jdd+"%' and moduleid = '"+trainid+"' and type = 01";
   Query qu = session.createQuery(hql);
   List singlechoose = qu.list();

 
  String hql = "select max(serial) from JX_ExerciseDb where type = " + type + " " +
    "and jdd like  '" + jdd + "%"+isimport+"' and moduleid = " + moduleid + " and usestate = 01  "; 
 
在进行模糊查询时,QBC里用了"%"+jdd+"%",在最外面用了双引号;HQL里用了'%"+jdd+"%' ,在这里是使用的单引号。
 
在MYSQL中 使用like "%bin%"
在ORACLE中 使用like '%bin%'
原文地址:https://www.cnblogs.com/han-java/p/9481585.html