Mybatis Base_Column_List错误解决方法

用“mapperLocations”属性指定 MyBatis 的 XML 映射文件的位置

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

 

运行后报如下错误信息:

java.lang.IllegalArgumentException: XML fragments parsed from previous mappers does not contain value for com.nechx.mapper.AdvertismentMapper.Base_Column_List
	at org.apache.ibatis.session.Configuration$StrictMap.get(Configuration.java:593)
	at org.apache.ibatis.builder.xml.XMLStatementBuilder$IncludeNodeHandler.handleNode(XMLStatementBuilder.java:155)
	at org.apache.ibatis.builder.xml.XMLStatementBuilder.parseDynamicTags(XMLStatementBuilder.java:85)
	at org.apache.ibatis.builder.xml.XMLStatementBuilder.parseStatementNode(XMLStatementBuilder.java:43)
	at org.apache.ibatis.session.Configuration.parseStatementNodes(Configuration.java:513)
	at org.apache.ibatis.session.Configuration.buildStatementsForNamespace(Configuration.java:502)
	at org.apache.ibatis.session.Configuration.buildStatementsFromId(Configuration.java:467)
	at org.apache.ibatis.session.Configuration.getMappedStatement(Configuration.java:391)
	at org.apache.ibatis.binding.MapperMethod.setupCommandType(MapperMethod.java:160)
	at org.apache.ibatis.binding.MapperMethod.<init>(MapperMethod.java:48)
	at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:37)
	at $Proxy13.insertSelective(Unknown Source)
......

 

网上查了原因,说是Mybatis低版本的bug

 

解决方法:

将原来用的

mybatis-3.0.4.jar”,

mybatis-spring-1.0.0.jar

替换成

mybatis-3.2.1.jar,

mybatis-spring-1.2.0.jar

 

 

参考:http://code.google.com/p/mybatis/issues/detail?id=250

 

你可能感兴趣的:(mybatis)