1: 书写sqlmap.xml dtd位置׃com.ibatis.sqlmap.engine.builder.xml.sql-map-2.dtd
xml文件头:
2:书写iBATIS - SqlMapConfig.xml dtd位置׃com.ibatis.sqlmap.engine.builder.xml.sql-map-config-2.dtd
xml文件头:
3: Spring - ApplicationContext.xml 中注册SqlMapClient
完整写法
4: DAO实现类继续org.springframework.orm.ibatis.support.SqlMapClientDaoSupport
在Spring配置文件的相关位置注入SqlMapClient
[color=indigo]转载请注明: [url]http://chrislee.iteye.com/[/url][/color]
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">
<sqlMap namespace="">
<typeAlias alias="" type=""/>
<cacheModel type="LRU" id="">
<flushInterval hours="24"/>
<property name="size" value="1000"/>
</cacheModel>
</sqlMap>
2:书写iBATIS - SqlMapConfig.xml dtd位置׃com.ibatis.sqlmap.engine.builder.xml.sql-map-config-2.dtd
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'>
<sqlMapConfig>
<sqlMap resource="bookstore/vo/Book.xml" />
</sqlMapConfig>
3: Spring - ApplicationContext.xml 中注册SqlMapClient
完整写法
<bean id="sqlMapClient" class="org.springframework.orm.ibatis.SqlMapClientFactoryBean">
<property name="configLocation" value="/sqlMappingConfig.xml" />
<property name="dataSource" ref="dataSource" />
</bean><!-- 注意:B/S写法 value=WEB-INF/sqlMappingConfig.xml-->
4: DAO实现类继续org.springframework.orm.ibatis.support.SqlMapClientDaoSupport
在Spring配置文件的相关位置注入SqlMapClient
[color=indigo]转载请注明: [url]http://chrislee.iteye.com/[/url][/color]