<prop key="hibernate.dialect">
新增类
OracleDialect
</prop>
OracleDialect extends org.hibernate.dialect.Oracle10gDialect
重写 getLimitString方法
sql = sql.trim(); boolean isForUpdate = false; if (sql.toLowerCase().endsWith(" for update")) { sql = sql.substring(0, sql.length() - 11); isForUpdate = true; } StringBuffer pagingSelect = new StringBuffer(sql.length() + 100); if (hasOffset) { pagingSelect.append("select * from ( select row_.*, rownum rownum_ from ( "); } else { //pagingSelect.append("select * from ( "); pagingSelect.append("select * from ( select row_.*, rownum rownum_ from ( "); } pagingSelect.append(sql); if (hasOffset) { pagingSelect.append(" ) row_ where rownum <= ?) where rownum_ > ?"); } else { // pagingSelect.append(" ) where rownum <= ?"); pagingSelect.append(" ) row_ where rownum <= ?) where rownum_ > 0"); } if (isForUpdate) { pagingSelect.append(" for update"); } return pagingSelect.toString();
标签:语句,pagingSelect,Hibernate,第二页,select,sql,rownum,append From: https://www.cnblogs.com/fengyu9/p/17087968.html