标签:
SELECT * FROM ( SELECT ROWNUM,A.* FROM ( SELECT * FROM STUDENT ORDER BY createTime DESC )A WHERE ROWNUM <= 10 ) WHERE ROWNUM >=1;
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN" "http://ibatis.apache.org/dtd/sql-map-2.dtd" > <sqlMap namespace="student"> <typeAlias alias="Student" type="com.bobo.code.model.Student" /> <select id="select" resultClass="Student"> SELECT * FROM ( SELECT A.*,ROWNUM FROM (SELECT * FROM STUDENT) A WHERE <![CDATA[ ROWNUM <= #minRownnum#]]> ) WHERE <![CDATA[ROWNUM >= #maxRownum#]]> </select> <select id="count" resultClass="java.lang.Integer"> SELECT count(*) FROM STUDENT </select> </sqlMap>
queryMap.put("minRownnum", (pageNumber - 1)*Pager.DEFAULT_PAGE_SIZE +1);//oracle rownum起 queryMap.put("maxRownum", pageNumber * Pager.DEFAULT_PAGE_SIZE );//oracle rownum止
当Student的属性id 为Integer,和数据库中的字段ID为VARCHAR2 导致不对应会取不出数据
标签:
原文地址:http://www.cnblogs.com/whatlonelytear/p/4848552.html