iBATIS 三个版本小细节对比

iBATIS 三个版本小细节对比

sqlMapConfig.xml 中的异同:

 iBATIS_v1iBATIS_v2iBATIS_v3
DOCTYPEsql-map-config.dtdsql-map-config-2.dtdibatis-3-config.dtd

configuration标签

<sql-map-config>

</sql-map-config>

<sqlMapConfig>

</sqlMapConfig>

<configuration>

</configuration>

sqlMap标签

<sql-map recource../><sqlMap recource../>

<mappers>

   <mapper recource.. />

</mappers>

sqlMap 映射中的异同  

 iBATIS_v1iBATIS_v2iBATIS_v3
DOCTYPEsql-map.dtdsql-map-2.dtdibatis-3-mapper.dtd

sqlMap标签

<sql-map>

</sql-map>

<sqlMap>

</sqlMap>

<mapper>

</mapper>

statement标签

<mapped-statement>

</mapped-statement>

<select></select>

<update></update>

<statement></>…

<select></select>

<update></update>

参数表示#id##id##{id}

sqlMap API的异同

 iBATIS_v1iBATIS_v2iBATIS_v3
执行对象SqlMapSqlMapClientSqlSession
得到执行

XMLSqlMapBuilder->

builderSqlMap

SqlMapClientBuilder->

builderSqlMap

SqlSessionFactory->

openSession

执行excuteQueryForObject

queryForObject..

queryForList…

update…

selectOne…

selectList…

update…

 

相关推荐