`
中国爪哇程序员
  • 浏览: 164865 次
  • 性别: Icon_minigender_1
  • 来自: 杭州
社区版块
存档分类
最新评论

ibatise 之 queryForList(final String statementName, final Object parameterObj

 
阅读更多
  /**
   * Executes a mapped SQL SELECT statement that returns data to populate
   * a number of result objects within a certain range.
   * <p/>
   * The parameter object is generally used to supply the input
   * data for the WHERE clause parameter(s) of the SELECT statement.
   *
   * @param id              The name of the statement to execute.
   * @param parameterObject The parameter object (e.g. JavaBean, Map, XML etc.).
   * @param skip            The number of results to ignore.
   * @param max             The maximum number of results to return.
   * @return A List of result objects.
   * @throws java.sql.SQLException If an error occurs.
   */
  List queryForList(String id, Object parameterObject, int skip, int max) throws SQLException;

测试,针对oracle为例,原始SQL :
select * from table

经该方法封装后的SQL:
select * from ( select row_limit.*, rownum rownum_ from (select * from table ) row_limit where rownum <= (skip+max) ) where rownum_ >max

分享到:
评论

相关推荐

    springmvc-jdbcTemplate

    public List&lt;Map&lt;String, Object&gt;&gt; search(String sql, Map&lt;String, Object&gt; params) throws DaoAccessException { try { logger.debug(sql); return namedParameterJdbcTemplate.queryForList(sql, params...

    Java实现Json字符串与Object对象相互转换的方式总结

    主要介绍了Java实现Json字符串与Object对象相互转换的方式,结合实例形式总结分析了java基于Json-Lib、Org.Json、Jackson、Gson、FastJson五种方式转换json类型相关操作技巧,需要的朋友可以参考下

    Java 使用JdbcTemplate 中的queryForList发生错误解决办法

    主要介绍了Java 使用JdbcTemplate 中的queryForList发生错误解决办法的相关资料,需要的朋友可以参考下

    对DAO编写单元测试源代码

    } &lt;br&gt; public boolean updatePassword(String username, String oldPassword, String newPassword) { if(!newPassword.matches(User.REGEX_PASSWORD)) return false; return 1==HibernateUtil....

    springmvc+spring+springjdbc商品列表展示修改

    该项目采用springmvc+spring+springjdbc框架+mysql框架实现 包含了jdbcTemplate的使用。queryForList,匿名内部类方式查询。 将List&lt;Map&lt;String,Object&gt;&gt;转换成List方法。

    MyBatis单表增删改多表查询

    适合初学者,主要写了单表的增删改,主要配置文件的介绍,还有多表一对多,多对一的查询例子,分别用了mysql(多表的),和sqlserver(设计单表的),

    阿里巴巴编码规范 基础技能认证 考题分析(考题+答案).docx

    B .iBATIS自带的queryForList(String statementName,int start,int size)分页接口有性能隐患,不允许使用。 C .定义明确的sql查询语句,通过传入参数start和size来实现分页逻辑。 D .可使用存储过程写分页逻辑...

    ibatis总结 ibatis ibatis ibatis ibatis

    ibatis学习 ibatis总结 ibatis ibatis ibatis

    DbOperate.java

    远程备份linux系统oracle以及导入

    iBatis-设置缓存模式-Java源码(下载)

    -- Insert example, using the Account parameter class --&gt; &lt;insert id="insertAccount" parameterClass="Account"&gt; insert into ACCOUNT ( ACC_ID, ACC_FIRST_NAME, ACC_LAST_NAME, ACC_EMAIL )...

    使用jdbcTemplate查询返回自定义对象集合代码示例

    主要介绍了使用jdbcTemplate查询返回自定义对象集合代码示例,分享了相关代码示例,小编觉得还是挺不错的,具有一定借鉴价值,需要的朋友可以参考下

    spring 高性能 代码

    spring的良好的扩展性,集成度,IOC,AOP事务,已经是项目的基础条件. ... String userName= baseFangService.queryForObjectByByFunction(finder,String.class); System.out.println(userName); }

    如何避免JDBC引起的内存溢出情况

    有的时候,我们需要一次查询很多的数据,或者是说每次查询的数据量都很大,都有可能早晨内存溢出的情况,所以我们今天分别针对三个数据库来探讨如何避免这一问题。

    JdbcTemplate的jar包.rar

    查询所有的内容,封装为list用 :template.queryForList(sql) 查询所有的内容,封装为对象用:template.query(sql, new BeanPropertyRowMapper&lt;对象&gt;(对象.class)); 查询需要使用聚合函数的内容,如:select count...

    ibatis源码 例子

    ibatis 源码 例子 包含 源码,jar都有 部分代码 package com.icss.dao; import java.io.IOException;...import java.io.Reader;...import java.sql.SQLException;... return sqlMapper.queryForList("selectAll");

    query-types:处理Express req.query对象的数字和布尔值

    查询类型处理Express req.query对象的数字和布尔值。设置 $ npm install --save query-types用法 var queryType = require ( 'query-types' ) ;var express = require ( 'express' ) ;app . use ( queryType ....

    ibatis 缓存配置策略

    • queryForObject和queryForList都可以缓存。其它片断不支持。 • 可以设定为定时刷新或受条件触发刷新Key。如:在执行Update的时候,可以刷新Cache。 刷新Cache时,无法手动控制刷新单条记录。只能刷新该Cache ID...

    ibatis01案例【查询】

    ArrayList&lt;User&gt; uList = (ArrayList) client.queryForList("selectAllUser"); for (User u:uList) { System.out.print(u.getUname()); System.out.println(u.getUpwd()); }

    spring-jdbc-operations:演示Spirng JDBCTemplate操作,例如query(),queryForObject(),QueryList()和检索自动生成的键

    spring-jdbc-operations 演示Spirng JDBCTemplate操作,例如query(),queryForObject(),QueryForList()以及如何使用PreparedStatementCreator检索自动生成的键。 #技术堆栈。 Spring JDBC。 HSQL InMemory...

Global site tag (gtag.js) - Google Analytics