iBATIS 动向

目前 iBATIS Data Mapper for Java(以下简称:iBATIS Data Mapper)的版本为 2.1.5。当前以及未来的 iBATIS Data Mapper 将加入以下新特征。
来自第三方的贡献
Alex Egorov 的 SQL Map 生成器(http://alxeg.narod.ru/ibatis/index.html)。Alex 创建了一些便利的脚本来生成你所有的 SQL Maps 和 VO。如果你正在寻找这种快速开发工具,它将是个可以一试的工具。这个站点有点慢,但是这点等待总比你手工编码的时间来得快。
DDL如下:
|
CREATE TABLE USER_PROPERTY ( |
VO如下:
|
package org.mystuff.db; |
映射文件如下:
<?xml version='1.0'?>
<!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN"
"http://www.ibatis.com/dtd/sql-map-2.dtd">
<!-- WARNING: This is an autogenerated file -->
<sqlMap name="UserProperty">
<cacheModel id="userproperty-cache" type="MEMORY">
<flushInterval hours="24"/>
<flushOnExecute statement="insertUserProperty"/>
<flushOnExecute statement="updateUserProperty"/>
<flushOnExecute statement="deleteUserProperty"/>
<property name="reference-type" value="WEAK" />
</cacheModel>
<resultMap class="org.mystuff.db.UserProperty" id="userproperty-result" >
<result property="firstName" column="FIRST_NAME" />
<result property="birthDate" column="BIRTH_DATE" />
<result property="lastName" column="LAST_NAME" />
<result property="userId" column="USER_ID" />
</resultMap>
<select id="getUserProperty" resultClass="org.mystuff.db.UserProperty"
parameterClass="org.mystuff.db.UserProperty" resultMap="userproperty-result" >
<![CDATA[
select * from USER_PROPERTY
where USER_ID = #userId#
]]>
</select>
<update id="updateUserProperty" parameterClass="org.mystuff.db.UserProperty">
<![CDATA[
update USER_PROPERTY
set FIRST_NAME = #firstName# , BIRTH_DATE = #birthDate#
, LAST_NAME = #lastName#
where USER_ID = #userId#
]]>
</update>
<insert id="insertUserProperty" parameterClass="org.mystuff.db.UserProperty">
<![CDATA[
insert into USER_PROPERTY(FIRST_NAME, BIRTH_DATE, LAST_NAME, USER_ID)
values(#firstName#, #birthDate#, #lastName#, #userId#)
]]>
</insert>
<delete id="deleteUserProperty" parameterClass="org.mystuff.db.UserProperty">
<![CDATA[
delete from USER_PROPERTY
where USER_ID = #userId#
]]>
</delete>
</sqlMap>
|
Jasmine IDE iBATIS GUI(http://jasmineide.sourceforge.net)。在构建映射文件、VO、DAO 类(不是 iBATIS 的 DAO,而是一个调用 sqlclient 方法的 java 类)方面这是最好的了,通过点击几下鼠标就可生成。这个工具允许你建立一个项目并设置 DB 连接连同所有通常用到的配置文件。(首先你需要设置自己的 DB 连接,确定你的驱动程序和所有 jar 都在系统类路径中)

我想,随着时间的推移,会有更多的开发者加入为 iBATIS 添砖加瓦的行列。
重要改进议题
http://wiki.apache.org/ibatis/Improved_Dynamic_SQL_Whiteboard 这里正在讨论关于改进动态 SQL 的白板,让 iBATIS Data Mapper 在动态 SQL 方面更强大。另外,当开发某个有着大量查询和大量数据的系统时,通常也会对这些数据的子集进行开发。“记录长时间运行的查询”功能将加快开发进度,能帮助开发者或 DBA 了解哪个查询慢或尚未优化,找出潜在瓶颈。为了引入这种新特性,也许会修改 sqlmap 配置文件(比如默认临界值),也会在 mapped statement 中增加新属性(用来覆盖默认临界值)。

浙公网安备 33010602011771号