oracle用Hibernate查询时异常

yihuaheren009 2011-07-13 10:55:18
有如下语句:
select bank.idbank,bank.cname as cname,case ch.totalcount when null then 0 else ch.totalcount end as totalcount,case ch.unsigntotal when null then 0 else ch.unsigntotal end as unsigntotal ,case ch.signtotal  when null then 0 else ch.signtotal  end as signtotal  from (select idcenter as idbank,	count(distinct case when  sts =0 then accno end) as totalcount,	count(distinct case when signflag ='0'  and sts='0' then accno end ) as unsigntotal,	count(distinct case when signflag ='1'  and sts='0' then accno end ) as signtotal from actctrlinfo where 1=1  and idcenter  in('9999','9903','9904','9188','9288','9588','9988','9998','9900','9901','9902','0700','9990','9905','9499','9199','9299','9399','9599','9699','9999','9199','9299','9903','9399','9599','9904','9699','9188','9288','9588','9988','9499','9998','9900','9901','9902','0700','9990','9905','9188','9288','9588','9988')  group by idcenter) ch left join (select distinct idbank,cname from param_bank ) bank on bank.idbank = ch.idbank  order by ch.idbank

我用PL SQL是可以查询出来数据的,但是我用Hibernate的查询时会报异常,代码如下:

Connection con = getHibernateTemplate().getSessionFactory().openSession().connection();
try {
ResultSet rs = con.prepareStatement(sql).executeQuery();
if (rs == null || rs.wasNull()) {
.......;
} else {
.......;
}
}finally{
try {
con.close();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}


在判断rs.wasNull()时抛出异常:java.sql.SQLException: 未读取数据,这是为神马呢?
...全文
198 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

3,491

社区成员

发帖
与我相关
我的任务
社区描述
Oracle 高级技术相关讨论专区
社区管理员
  • 高级技术社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧