今天新项目Mybatis要映射的表比较多, 所以加了个通配符,

加完发现一个bug, 

查了半天 更新Mybatis和Mybatis-spring这俩jar包解决了 小记一下


具体来讲:

1.先加通配符

<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
		<property name="dataSource" ref="dataSource"/>
		<property name="configLocation" value="classpath:mybatis/config.xml"/>
		<property name="mapperLocations" value="classpath:mybatis/attrGrid/*.xml"/>
	</bean>

2.在具体类的xml里

使用之前可以用的<sql>时,Mybatis会报错:

XML fragments parsed from previous mappers does not contain value for xxx.yyy zzz

原来确定能用的sql形如:

<sql id="columnsName">id,tables,name,max,min</sql>


因为这个无厘头的bug查了半天,

开始还以为是通配符出问题了

最后换成mybatis-3.2.2.jar + mybatis-spring-1.2.1目前没错



Logo

腾讯云面向开发者汇聚海量精品云计算使用和开发经验,营造开放的云计算技术生态圈。

更多推荐