关于hibernate的between的使用

SELECT * FROM t_project WHERE style=101 AND realCost BETWEEN 20*0.9 AND 20*1.1 AND realArea BETWEEN 40 AND 80 ORDER BY id DESC

PS ::: realCost 和 realArea都是varchar类型 ,并且数据库存的都是80.0 65.0之类的数据

在mysql执行没有问题

在hibernate中

String hql = "select p from cn.uihome.model.Project p where p.style = ? and p.realCost BETWEEN ? and ? and p.realArea BETWEEN ? AND ? order by id desc";
Query query=projectDao.createQuery(hql);
query.setString(0, map.get(houseStyle));
query.setInteger(1, (int)(allfquote*0.9));
query.setInteger(2, (int)(allfquote*1.1));
query.setInteger(3, houseArea-20);
query.setInteger(4, houseArea+20);
list = query.list();
查询的结果数为0

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问