JDBC错误:关闭的语句.

[code]
public class CompareFundDAO extends BaseHibernateDAO {
private static final Log log = LogFactory.getLog(TbSourceDAO.class);

@SuppressWarnings("unchecked")
public List<CompareFund> getCompareResult(String month){
try{
String where = "qymc not like '%测试%' and qymc not like '%hxtest%' and qymc not like '%zjca%' and qymc not like '%浙江ca%' and dqzt = '新领' and status > 0 and";

String hql1 = "select count(*)*500 from TbHx where "+where+" dqxzh = ? and indate <= ? and indate >= ?";

String hql2 = "select count(*)*500 from TbHx where "+where+" dqxzh = ? ";

List list = new ArrayList<CompareFund>();
TbBankStaticsDAO bankStaticsDAO = new TbBankStaticsDAO();
List baklist = bankStaticsDAO.findStaticRecord("", month);
if(baklist == null || baklist.size()==0){
log.error("没有这个月的数据");
return null;
}
Iterator it = baklist.iterator();
while(it.hasNext()){
TbBankStatics bankStatics = (TbBankStatics)it.next();
CompareFund compareFund = new CompareFund();
compareFund.setRaName(bankStatics.getTbRajg().getRaName());
compareFund.setIndate(bankStatics.getIndate());
compareFund.setIndateb(bankStatics.getIndateb());
compareFund.setAllmoney(bankStatics.getAllsum());
compareFund.setMonthmoney(bankStatics.getMonthmoney()+bankStatics.getMonthjust());
compareFund.setYearmoney(bankStatics.getYearmoney());
Double monthys = getYs(hql1, bankStatics, true);

compareFund.setMonthys(monthys);

Calendar calendar = Calendar.getInstance();
calendar.setTime(bankStatics.getIndateb());
calendar.set(Calendar.MONTH,1);
calendar.set(Calendar.DAY_OF_MONTH,1);
bankStatics.setIndate(calendar.getTime());
Double yearys = getYs(hql1, bankStatics, true);
compareFund.setYearys(yearys);

Double allys = getYs(hql2, bankStatics, false);
compareFund.setAllys(allys);

compareFund.setAllmargin(allys-bankStatics.getAllsum());
compareFund.setYearmargin(yearys-bankStatics.getYearmoney());
compareFund.setMonthmargin(monthys-bankStatics.getMonthmoney()-bankStatics.getMonthjust());
list.add(compareFund);
}

return list;

}catch(RuntimeException re){
throw re;
}
}

public Double getYs(String hql,TbBankStatics bankStatics,boolean chooes ){
Session session = null;
try {
session = getSession();
Query q = session.createQuery(hql);
q.setString(0, bankStatics.getTbRajg().getRaId());
if(chooes){
q.setDate(1, bankStatics.getIndate());
q.setDate(2, bankStatics.getIndateb());
}
Double money = ((Integer)q.list().get(0)).doubleValue();

return money;
}catch(RuntimeException re){
throw re;
}finally{
closeSession();//或者session.close()都不行
}
}


}
[/code]

可以执行几次循环(不确定的,随机),然后就暴错 ERROR (JDBCExceptionReporter.java:72) - 关闭的语句: next
谁碰到过好郁闷.
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值