这个是写在hibernate映射文件里的查询语句
<query name="com.wll.student.model.YwXsjbxx.select">
     from YwXsjbxx
     where xsxm like :pxsxm and xh like :pxh and xb like :pxb
</query>
其中在YwXsjbxx类中 xsxm 和 xh是String类型,xb是Integer类型。
在Action里定义
Map<String, Object> conditions = new HashMap<String, Object>();
if(xsxm.equals("")){
        conditions.put("pxsxm","%%");
}else{
conditions.put("pxsxm",xsxm);
}
if(xh.equals("")){
conditions.put("pxh","%%");
}else{
conditions.put("pxh",xh);
}
if(xb == 0){
conditions.put("pxb","%%");
}else{
conditions.put("pxb",xb);
}
我要实现的功能就是在JSP页面上有选择的输入,在查询时根据是否输入值进行查询,但在HQL语句中有很多Integer类型的字段,在Map中put进去conditions.put("pxb","%%");但在执行HQL语句时pxb所对应的属性是Integer类型的,无法查询。要是按我这样的思路要怎么做才能实现这样的功能呢?请高手指点啊!