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: 未读取数据,这是为神马呢?
...全文
112 回复 点赞 打赏 收藏 举报
写回复
回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
相关推荐
发帖
Oracle 高级技术
加入

3436

社区成员

Oracle 高级技术相关讨论专区
申请成为版主
帖子事件
创建了帖子
2011-07-13 10:55
社区公告
暂无公告