`
gaoyuntao2005
  • 浏览: 304215 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

spring ibatis

阅读更多

这两个版本支持通配符设置配置文件了

spring的配置文件中设置如下:

<bean id="sqlMapClient" class="org.springframework.orm.ibatis.SqlMapClientFactoryBean">
  <property name="configLocation" value="ibatis/config/SqlMapConfig.xml" />
  <property name="mappingLocations" value="ibatis/sqlmap/*.xml" />
  <property name="dataSource" ref="dataSource" />
 </bean>

ibatis的配置文件SqlMapConfig.xml中

<sqlMapConfig>

 <settings cacheModelsEnabled="true" enhancementEnabled="true"
  classInfoCacheEnabled="true" lazyLoadingEnabled="false" maxRequests="150"
  maxSessions="100" maxTransactions="10" useStatementNamespaces="true" />
</sqlMapConfig>

但是启动的时候还是会报一个异常,SqlMapConfig.xml中必须满足

(properties?, settings?, resultObjectFactory?, typeAlias*, typeHandler*, transactionManager?, sqlMap+)+

的约束,这个一看就知道是dtd里的问题,所以就在ibatis的jar包,找到com.ibatis.sqlmap.engine.builder.xml下的sql-map-config-2.dtd

找到上面那句话,改成

(properties?, settings?, resultObjectFactory?, typeAlias*, typeHandler*, transactionManager?, sqlMap?)+

就可以了

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics