JdbcTemplate 的oracle分页
Posted qinyios
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了JdbcTemplate 的oracle分页相关的知识,希望对你有一定的参考价值。
@Autowired private JdbcTemplate jd;
int ps1=Integer.valueOf(pageSize); int cp1=Integer.valueOf(currPage);
StringBuffer stringBuffer = new StringBuffer(); stringBuffer.append("SELECT * FROM (SELECT ROWNUM AS rowno, t.* FROM fhcb_08_tbl_ext_attributes t WHERE ROWNUM <="+cp1*ps1+" ) table_alias WHERE table_alias.rowno >= "+((cp1-1)*ps1+1)); List<Map<String, Object>> countList = jd .queryForList("SELECT COUNT(1) AS count FROM fhcb_08_tbl_ext_attributes"); count = Integer.parseInt(String.valueOf(countList.get(0).get("count"))); pageCount = (count % psize) == 0 ? count / psize : count / psize + 1; queryForList = jd.queryForList(stringBuffer.toString());
以上是关于JdbcTemplate 的oracle分页的主要内容,如果未能解决你的问题,请参考以下文章
spring jdbc踩坑日记,new JdbcTemplate 为null导致UserDao一直为null
java.sql.SQLException: Io 异常: The Network Adapter could not establish the connection at oracle.jdb