三 第二步中涉及DataSource,其配置信息包含在 jdbc-template.properties 文件中 文件路径为
  工程目录confjdbc-template.properties 代码如下
# Properties file with JDBC-related settings.
# Applied by PropertyPlaceholderConfigurer from "applicationContext.xml".
# Targeted at system administrators, to avoid touching the context XML files.
#jdbc.driverClassName=com.mysql.jdbc.Driver
#jdbc.url=jdbc:mysql://localhost:3306/mps
#jdbc.username=root
#jdbc.password=skywin
jdbc.initialSize=1
jdbc.maxActive=10
jdbc.driverClassName=oracle.jdbc.OracleDriver
#jdbc.url=jdbc:oracle:thin:@10.244.112.130:41521:gmcctes
#jdbc.url=jdbc:oracle:thin:@10.244.112.130:1521:gmccmpp
jdbc.url=jdbc:oracle:thin:@192.168.100.235:1521:mpptest
jdbc.username=gmcc
jdbc.password=skywin
#imageDatabase.lobHandler=oracleLobHandler
  第二步中的   <property name="configLocation" value="sqlmap-config-template.xml"/> 为ibatis的中枢文件 文件路径是   工程目录confsqlmap-config-template.xml 代码如下:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE sqlMapConfig
PUBLIC "-//ibatis.apache.org//DTD SQL Map Config 2.0//EN"
"http://ibatis.apache.org/dtd/sql-map-config-2.dtd">
<!-- Leonel Wong 2008-11-6 17:24:04 -->
<sqlMapConfig>
<sqlMap resource="ibatis-conf/MpsAppendixInf.xml" />
<sqlMap resource="ibatis-conf/MpsDispatchLog.xml" />
<sqlMap resource="ibatis-conf/MpsFunctionType.xml" />
<sqlMap resource="ibatis-conf/MpsFundType.xml" />
<sqlMap resource="ibatis-conf/MpsInGatewayInf.xml" />
<sqlMap resource="ibatis-conf/MpsModuleInf.xml" />
<sqlMap resource="ibatis-conf/MpsOperationType.xml" />
<sqlMap resource="ibatis-conf/MpsOrderClaimant.xml" />
<sqlMap resource="ibatis-conf/MpsPayType.xml" />
<sqlMap resource="ibatis-conf/MpsProcessApproveLog.xml" />
<sqlMap resource="ibatis-conf/MpsProcessLog.xml" />
<sqlMap resource="ibatis-conf/MpsProcessRemark.xml" />
<sqlMap resource="ibatis-conf/MpsReceiveOrderLog.xml" />
<sqlMap resource="ibatis-conf/MpsServiceInfo.xml" />
<sqlMap resource="ibatis-conf/MpsUploadFile.xml" />
<sqlMap resource="ibatis-conf/MpsUrgentLevel.xml" />
<sqlMap resource="ibatis-conf/MpsVerifyLog.xml" />
<sqlMap resource="ibatis-conf/MpsWorkOrder.xml" />
<sqlMap resource="ibatis-conf/MpsWorkOrderCancelLog.xml" />
<sqlMap resource="ibatis-conf/MpsWorkOrderCloseLog.xml" />
<sqlMap resource="ibatis-conf/MpsWorkOrderType.xml" />
<sqlMap resource="ibatis-conf/MpsOperatorInf.xml" />
<sqlMap resource="ibatis-conf/MpsOrderServiceInfo.xml" />
<sqlMap resource="ibatis-conf/MpsTree.xml" />
<sqlMap resource="ibatis-conf/MpsOperatorTree.xml" />
<sqlMap resource="ibatis-conf/MpsTest.xml" />
<sqlMap resource="ibatis-conf/MpsSpInfo.xml" />
</sqlMapConfig>
  四 ormpping文件,这里以MpsTest.xml文件为例子,该文件路径是
  工程目录/confibatis-confMpsTest.xml 代码如下:
<?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">
<!-- qjk 2009-02-02 -->
<sqlMap namespace="MpsTest">
<resultMap id="result" class="com.skywin.workorder.model.MpsTest">
<result property="testId" column="testid" columnIndex="1" />
<result property="mpsWorkOrder.orderId" column="orderid" columnIndex="2" />
<result property="wfid" column="wfid" columnIndex="3" />
<result property="testResult" column="testResult" columnIndex="4" />
<result property="testDate" column="testdate" columnIndex="5" />
<result property="testPerson" column="testPerson" columnIndex="6" />
<result property="testDesc" column="testDesc" columnIndex="7" />
</resultMap>
<insert id="saveMpsTest">
insert into wo_test(testid,orderid,wfid,testResult,testdate,testPerson,testDesc)
values(#testId#,#mpsWorkOrder.orderId#,#wfid#,#testResult#,#testDate#,#testPerson#,#testDesc#)
</insert>
<delete id="deleteMpsTestById">
delete from wo_test where testid=#value#
</delete>
<select id="findAllMpsTest" resultMap="result">
select * from wo_test
</select>
<select id="findAllMpsTestCount" resultClass="Long">
select count(*) from wo_test
</select>
<select id="findMpsTestNextSeq" resultClass="Long">
select wo_test_seq.nextval from dual
</select>
</sqlMap>
  五 dao实现类代码:
package com.skywin.workorder.dao.Impl;
import java.util.List;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;
import com.skywin.workorder.dao.MpsTestDao;
import com.skywin.workorder.model.MpsTest;
import com.skywin.workorder.util.ListResult;
public class MpsTestDaoImpl extends SqlMapClientDaoSupport implements MpsTestDao {
public int deleteMpsTestById(Long testId) {
return getSqlMapClientTemplate().delete("deleteMpsTestById", testId);
}
public List findAllMpsTest(int pagesize, int pageIndex) {
return getSqlMapClientTemplate().queryForList("findAllMpsTest", null, pageIndex*pagesize, pagesize);
}
public Long findAllMpsTestCount() {
return (Long) getSqlMapClientTemplate().queryForObject("findAllMpsTestCount", null);
}
public ListResult pageAllMpsTest(int pagesize, int pageIndex) {
ListResult listResult=new ListResult();
listResult.setResult(findAllMpsTest(pagesize,pageIndex));
listResult.setCount(findAllMpsTestCount());
return listResult;
}
public MpsTest saveMpsTest(MpsTest mpsTest) {
getSqlMapClientTemplate().insert("saveMpsTest",mpsTest);
return mpsTest;
}
public Long findMpsTestNextSeq() {
return (Long) getSqlMapClientTemplate().queryForObject("findMpsTestNextSeq", null);
}
}