为什使用hql查询的结果比实际的结果少一条
public List findBypkidpayernamepaytaxcategories(String pkid,
String payername, String paytaxcategories, int page, int pageSize) {
List result = new ArrayList();
StringBuffer hql = new StringBuffer();
hql.append("select bt.payername,bt.pkid from BssTaxpayers bt,BssFchshyshk bf "
+ "where flbzcz <> 'CZ' and flbzzy <> 'ZY' and bt.pkid = bf.nsrdzdah ");
Map params = new HashMap();
if (pkid != null && pkid.length() > 0) {
hql.append(" and bt.pkid = :pkid ");
params.put("pkid", pkid);
}
if (payername != null && payername.length() > 0) {
hql.append(" and bt.payername = :payername ");
params.put("payername", payername);
}
if (paytaxcategories != null && paytaxcategories.length() > 0) {
hql.append(" and bt.paytaxcategories = :paytaxcategories ");
params.put("paytaxcategories", paytaxcategories);
}
List list = (List) hibernateHelper.getList(hql.toString(), params,
true, page, pageSize);
for (Object[] objects : list) {
Map map = new HashMap();
map.put("payername", objects[0]);
map.put("pkid", objects[1]);
result.add(map);
}
return result;
}
求大神解救啊!急啊!!!!!!
------解决方案--------------------
看代码没什么问题啊,将拼接的语句换个环境执行下,看看查询结果是否和当前程序执行结果一致
------解决方案--------------------
这个本身是分页查询的一种写法,是不是查询结果记录数超出pageSize,因此显示不全