设为首页收藏本站

LUPA开源社区

 找回密码
 注册
文章 帖子 博客
LUPA开源社区 首页 业界资讯 软件追踪 查看内容

Apache Commons DbUtils 1.6发布

2014-7-22 16:24| 发布者: joejoe0332| 查看: 1860| 评论: 0|原作者: oschina|来自: oschina

摘要:   Apache Commons DbUtils 1.6 发布,主要改进内容包括:ArrayHandler should return an empty array when handle has no rows FixesDBUTILS-110.Order of columns not retained in BasicRowProcessor with HashMa ...

  Apache Commons DbUtils 1.6 发布,主要改进内容包括:


  • ArrayHandler should return an empty array when handle has no rows Fixes DBUTILS-110.

  • Order of columns not retained in BasicRowProcessor with HashMap Fixes DBUTILS-114. 

  • BeanProcessor not returning nanoseconds Fixes DBUTILS-118. 

  • Add support for conversion of ResultSet strings to enums in the BeanProcessor FixesDBUTILS-113. 

  • In BeanProcessor#isCompatibleType, can Integer.class.isInstance(value) be replaced by value instanceof Integer (etc)?        Simplified code by using instanceof. Fixes DBUTILS-85.

  • DBUtils can't build using JDK 1.7 - DriverProxy needs to implement getParentLogger()        Add dynamic invocation. Fixes DBUTILS-106. 

  • Create functionality to return auto-generated keys in batches of SQL inserts Fixes DBUTILS-108. 

  • Patch QueryLoader to also load from XML properties files Fixes DBUTILS-107.

  • Updated the use of getColumnName to try getColumnLabel first Fixes DBUTILS-100.

  • Add missing JavaDoc to QueryRunner#insert Fixes DBUTILS-98.

  • Add an Abstract ResultSetHandler implementation in order to reduce redundant 'resultSet' variable invocation Fixes DBUTILS-97.

  • DbUtils#loadDriver(ClassLoader,String) makes DriverManager throwing "No suitable driver found for jdbc"        if ClassLoader is not the System's one Fixes DBUTILS-96.

  • Added insert methods to QueryRunner and AsyncQueryRunner that return the generated key. Fixes DBUTILS-87.


  此版本源代码和二进制包都已提供下载


Maven:
  <groupId>commons-dbutils</groupId>
  <artifactId>commons-dbutils</artifactId>
  <version>1.6</version>


  更多更新内容请看发行说明


  原则上这不能说是一个持久层框架,它提供了一些Jdbc的操作封装来简化数据查询和记录读取操作。本站就是采用这个项目来读写数据库,代码非常简洁,如果你厌烦了Hibernate的庞大,不妨可以试试——DbUtils。


  给出一小段代码看看DbUtils是怎么用的:

QueryRunner run = new QueryRunner(dataSource); // Use the BeanHandler implementation to convert the first
// ResultSet row into a Person JavaBean. ResultSetHandler h = new BeanHandler(Person.class); // Execute the SQL statement with one replacement parameter and
// return the results in a new Person object generated by the BeanHandler. Person p = (Person) run.query("SELECT * FROM Person WHERE name=?", "John Doe", h);


  JavaDoc:http://tool.oschina.net/apidocs/apidoc?api=commons-dbutils


  本站对 dbutils 做了一个改进,下载地址:http://www.oschina.net/uploads/app/commons-dbutils-1.1.fixed.jar
主要解决了dbutils无法处理类似 SELECT userid AS id FROM osc_users 诸如此类的问题,因为 dbutils 使用的方法是 getColumnName 而不是 getColumnLabel (此问题已经在官方的1.3版本中得以解决)。


酷毙

雷人

鲜花

鸡蛋

漂亮
  • 快毕业了,没工作经验,
    找份工作好难啊?
    赶紧去人才芯片公司磨练吧!!

最新评论

关于LUPA|人才芯片工程|人才招聘|LUPA认证|LUPA教育|LUPA开源社区 ( 浙B2-20090187 浙公网安备 33010602006705号   

返回顶部