title: Mybatis - Mapping error on 3.2.7, works on 3.0.3
body: <p>I'm experiencing a mapping error in my project when using "mybatis 3.2.7.jar" but it works using version 3.0.</p>
  
  <hr>
  
  <p>(trial is based on loaine sample hello world mybatis)
  This is the whole sample project file:</p>
  
  <pre><code>package test.dao;
  
  import java.util.List;
  
  import org.apache.ibatis.session.SqlSession;
  import org.apache.ibatis.session.SqlSessionFactory;
  import test.model.Customer;
  import test.model.CustomerExample;
  
  public class CustomerDAO implements CustomerMapper{
  
      private SqlSessionFactory sqlSessionFactory; 
  
      public CustomerDAO(){
          sqlSessionFactory = MyBatisConnectionFactory.getSqlSessionFactory();
      }
  
      @Override
      public int countByExample(CustomerExample example) {
          // TODO Auto-generated method stub
          return 0;
      }
  
      @Override
      public int deleteByExample(CustomerExample example) {
          // TODO Auto-generated method stub
          return 0;
      }
  
      @Override
      public int deleteByPrimaryKey(Integer CONTACT_ID) {
          SqlSession session = sqlSessionFactory.openSession();
  
          try {
              session.insert("Customer.deleteByPrimaryKey", CONTACT_ID);
              session.commit();
          } finally {
              session.close();
          }
  
          return 0;
      }
  
      @Override
      public int insert(Customer record) {
          SqlSession session = sqlSessionFactory.openSession();
  
          try {
              session.insert("Customer.insert", record);
              session.commit();
          } finally {
              session.close();
          }
          return 0;
      }
  
      @Override
      public int insertSelective(Customer record) {
          // TODO Auto-generated method stub
          return 0;
      }
  
      @Override
      public List&lt;Customer&gt; selectByExample(CustomerExample example) {
          // TODO Auto-generated method stub
          return null;
      }
  
      @Override
      public Customer selectByPrimaryKey(Integer CONTACT_ID) {
          // TODO Auto-generated method stub
          return null;
      }
  
      @Override
      public int updateByExampleSelective(Customer record, CustomerExample example) {
          // TODO Auto-generated method stub
          return 0;
      }
  
      @Override
      public int updateByExample(Customer record, CustomerExample example) {
          // TODO Auto-generated method stub
          return 0;
      }
  
      public int updateByPrimaryKeySelective(Customer record) {
          int successStatus = 0;
          SqlSession session = sqlSessionFactory.openSession();
          try {
              successStatus = session.update("Customer.updateByPrimaryKeySelective", record);
              session.commit();
          } finally {
              session.close();
          }
          return successStatus;
      }
  
      @Override
      public int updateByPrimaryKey(Customer record) {
          // TODO Auto-generated method stub
          return 0;
      }
  
  }
  
  
  *******************************************************************************************
  package test.trial;
  
  import test.dao.CustomerDAO;
  import test.model.Customer;
  import test.model.CustomerExample;
  
  
  
  public class main {
  
      public static void main(String[] args) {
          // TODO Auto-generated method stub
  
          //insert
          Customer cus = new Customer();
          CustomerDAO cdao= new CustomerDAO();
          CustomerExample ce = new CustomerExample();
  
          cus.setCONTACT_ID(201);
          cus.setCONTACT_NAME("**** 2");
          cus.setCONTACT_EMAIL("xtian");
          cus.setCONTACT_PHONE("12345");
  
  
          //count
  //      cdao.deleteByPrimaryKey(105);
          cdao.updateByPrimaryKeySelective(cus);
          cdao.insert(cus);
          ce.isDistinct();
          System.out.println(cdao.countByExample(ce));
  
  //      cdao.deleteByPrimaryKey(100);
  
  
      }
  
  }
  </code></pre>
  
  <hr>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" &gt;
  &lt;mapper namespace="test.dao.CustomerMapper" &gt;
    &lt;resultMap id="BaseResultMap" type="test.model.Customer" &gt;
      &lt;!--
        WARNING - @mbggenerated
        This element is automatically generated by MyBatis Generator, do not modify.
        This element was generated on Tue Jun 17 09:23:52 CEST 2014.
      --&gt;
      &lt;id column="CONTACT_ID" property="CONTACT_ID" jdbcType="INTEGER" /&gt;
      &lt;result column="CONTACT_EMAIL" property="CONTACT_EMAIL" jdbcType="VARCHAR" /&gt;
      &lt;result column="CONTACT_NAME" property="CONTACT_NAME" jdbcType="VARCHAR" /&gt;
      &lt;result column="CONTACT_PHONE" property="CONTACT_PHONE" jdbcType="VARCHAR" /&gt;
    &lt;/resultMap&gt;
    &lt;sql id="Example_Where_Clause" &gt;
      &lt;!--
        WARNING - @mbggenerated
        This element is automatically generated by MyBatis Generator, do not modify.
        This element was generated on Tue Jun 17 09:23:52 CEST 2014.
      --&gt;
      &lt;where &gt;
        &lt;foreach collection="oredCriteria" item="criteria" separator="or" &gt;
          &lt;if test="criteria.valid" &gt;
            &lt;trim prefix="(" suffix=")" prefixOverrides="and" &gt;
              &lt;foreach collection="criteria.criteria" item="criterion" &gt;
                &lt;choose &gt;
                  &lt;when test="criterion.noValue" &gt;
                    and ${criterion.condition}
                  &lt;/when&gt;
                  &lt;when test="criterion.singleValue" &gt;
                    and ${criterion.condition} #{criterion.value}
                  &lt;/when&gt;
                  &lt;when test="criterion.betweenValue" &gt;
                    and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
                  &lt;/when&gt;
                  &lt;when test="criterion.listValue" &gt;
                    and ${criterion.condition}
                    &lt;foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," &gt;
                      #{listItem}
                    &lt;/foreach&gt;
                  &lt;/when&gt;
                &lt;/choose&gt;
              &lt;/foreach&gt;
            &lt;/trim&gt;
          &lt;/if&gt;
        &lt;/foreach&gt;
      &lt;/where&gt;
    &lt;/sql&gt;
    &lt;sql id="Update_By_Example_Where_Clause" &gt;
      &lt;!--
        WARNING - @mbggenerated
        This element is automatically generated by MyBatis Generator, do not modify.
        This element was generated on Tue Jun 17 09:23:52 CEST 2014.
      --&gt;
      &lt;where &gt;
        &lt;foreach collection="example.oredCriteria" item="criteria" separator="or" &gt;
          &lt;if test="criteria.valid" &gt;
            &lt;trim prefix="(" suffix=")" prefixOverrides="and" &gt;
              &lt;foreach collection="criteria.criteria" item="criterion" &gt;
                &lt;choose &gt;
                  &lt;when test="criterion.noValue" &gt;
                    and ${criterion.condition}
                  &lt;/when&gt;
                  &lt;when test="criterion.singleValue" &gt;
                    and ${criterion.condition} #{criterion.value}
                  &lt;/when&gt;
                  &lt;when test="criterion.betweenValue" &gt;
                    and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
                  &lt;/when&gt;
                  &lt;when test="criterion.listValue" &gt;
                    and ${criterion.condition}
                    &lt;foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," &gt;
                      #{listItem}
                    &lt;/foreach&gt;
                  &lt;/when&gt;
                &lt;/choose&gt;
              &lt;/foreach&gt;
            &lt;/trim&gt;
          &lt;/if&gt;
        &lt;/foreach&gt;
      &lt;/where&gt;
    &lt;/sql&gt;
    &lt;sql id="Base_Column_List" &gt;
      &lt;!--
        WARNING - @mbggenerated
        This element is automatically generated by MyBatis Generator, do not modify.
        This element was generated on Tue Jun 17 09:23:52 CEST 2014.
      --&gt;
      CONTACT_ID, CONTACT_EMAIL, CONTACT_NAME, CONTACT_PHONE
    &lt;/sql&gt;
    &lt;select id="selectByExample" resultMap="BaseResultMap" parameterType="test.model.CustomerExample" &gt;
      &lt;!--
        WARNING - @mbggenerated
        This element is automatically generated by MyBatis Generator, do not modify.
        This element was generated on Tue Jun 17 09:23:52 CEST 2014.
      --&gt;
      select
      &lt;if test="distinct" &gt;
        distinct
      &lt;/if&gt;
      &lt;include refid="Base_Column_List" /&gt;
      from contact
      &lt;if test="_parameter != null" &gt;
        &lt;include refid="Example_Where_Clause" /&gt;
      &lt;/if&gt;
      &lt;if test="orderByClause != null" &gt;
        order by ${orderByClause}
      &lt;/if&gt;
    &lt;/select&gt;
    &lt;select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" &gt;
      &lt;!--
        WARNING - @mbggenerated
        This element is automatically generated by MyBatis Generator, do not modify.
        This element was generated on Tue Jun 17 09:23:52 CEST 2014.
      --&gt;
      select 
      &lt;include refid="Base_Column_List" /&gt;
      from contact
      where CONTACT_ID = #{CONTACT_ID,jdbcType=INTEGER}
    &lt;/select&gt;
    &lt;delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" &gt;
      &lt;!--
        WARNING - @mbggenerated
        This element is automatically generated by MyBatis Generator, do not modify.
        This element was generated on Tue Jun 17 09:23:52 CEST 2014.
      --&gt;
      delete from contact
      where CONTACT_ID = #{CONTACT_ID,jdbcType=INTEGER}
    &lt;/delete&gt;
    &lt;delete id="deleteByExample" parameterType="test.model.CustomerExample" &gt;
      &lt;!--
        WARNING - @mbggenerated
        This element is automatically generated by MyBatis Generator, do not modify.
        This element was generated on Tue Jun 17 09:23:52 CEST 2014.
      --&gt;
      delete from contact
      &lt;if test="_parameter != null" &gt;
        &lt;include refid="Example_Where_Clause" /&gt;
      &lt;/if&gt;
    &lt;/delete&gt;
    &lt;insert id="insert" parameterType="test.model.Customer" &gt;
      &lt;!--
        WARNING - @mbggenerated
        This element is automatically generated by MyBatis Generator, do not modify.
        This element was generated on Tue Jun 17 09:23:52 CEST 2014.
      --&gt;
      insert into contact (CONTACT_ID, CONTACT_EMAIL, CONTACT_NAME, 
        CONTACT_PHONE)
      values (#{CONTACT_ID,jdbcType=INTEGER}, #{CONTACT_EMAIL,jdbcType=VARCHAR}, #{CONTACT_NAME,jdbcType=VARCHAR}, 
        #{CONTACT_PHONE,jdbcType=VARCHAR})
    &lt;/insert&gt;
    &lt;insert id="insertSelective" parameterType="test.model.Customer" &gt;
      &lt;!--
        WARNING - @mbggenerated
        This element is automatically generated by MyBatis Generator, do not modify.
        This element was generated on Tue Jun 17 09:23:52 CEST 2014.
      --&gt;
      insert into contact
      &lt;trim prefix="(" suffix=")" suffixOverrides="," &gt;
        &lt;if test="CONTACT_ID != null" &gt;
          CONTACT_ID,
        &lt;/if&gt;
        &lt;if test="CONTACT_EMAIL != null" &gt;
          CONTACT_EMAIL,
        &lt;/if&gt;
        &lt;if test="CONTACT_NAME != null" &gt;
          CONTACT_NAME,
        &lt;/if&gt;
        &lt;if test="CONTACT_PHONE != null" &gt;
          CONTACT_PHONE,
        &lt;/if&gt;
      &lt;/trim&gt;
      &lt;trim prefix="values (" suffix=")" suffixOverrides="," &gt;
        &lt;if test="CONTACT_ID != null" &gt;
          #{CONTACT_ID,jdbcType=INTEGER},
        &lt;/if&gt;
        &lt;if test="CONTACT_EMAIL != null" &gt;
          #{CONTACT_EMAIL,jdbcType=VARCHAR},
        &lt;/if&gt;
        &lt;if test="CONTACT_NAME != null" &gt;
          #{CONTACT_NAME,jdbcType=VARCHAR},
        &lt;/if&gt;
        &lt;if test="CONTACT_PHONE != null" &gt;
          #{CONTACT_PHONE,jdbcType=VARCHAR},
        &lt;/if&gt;
      &lt;/trim&gt;
    &lt;/insert&gt;
    &lt;select id="countByExample" parameterType="test.model.CustomerExample" resultType="java.lang.Integer" &gt;
      &lt;!--
        WARNING - @mbggenerated
        This element is automatically generated by MyBatis Generator, do not modify.
        This element was generated on Tue Jun 17 09:23:52 CEST 2014.
      --&gt;
      select count(*) from contact
      &lt;if test="_parameter != null" &gt;
        &lt;include refid="Example_Where_Clause" /&gt;
      &lt;/if&gt;
    &lt;/select&gt;
    &lt;update id="updateByExampleSelective" parameterType="map" &gt;
      &lt;!--
        WARNING - @mbggenerated
        This element is automatically generated by MyBatis Generator, do not modify.
        This element was generated on Tue Jun 17 09:23:52 CEST 2014.
      --&gt;
      update contact
      &lt;set &gt;
        &lt;if test="record.CONTACT_ID != null" &gt;
          CONTACT_ID = #{record.CONTACT_ID,jdbcType=INTEGER},
        &lt;/if&gt;
        &lt;if test="record.CONTACT_EMAIL != null" &gt;
          CONTACT_EMAIL = #{record.CONTACT_EMAIL,jdbcType=VARCHAR},
        &lt;/if&gt;
        &lt;if test="record.CONTACT_NAME != null" &gt;
          CONTACT_NAME = #{record.CONTACT_NAME,jdbcType=VARCHAR},
        &lt;/if&gt;
        &lt;if test="record.CONTACT_PHONE != null" &gt;
          CONTACT_PHONE = #{record.CONTACT_PHONE,jdbcType=VARCHAR},
        &lt;/if&gt;
      &lt;/set&gt;
      &lt;if test="_parameter != null" &gt;
        &lt;include refid="Update_By_Example_Where_Clause" /&gt;
      &lt;/if&gt;
    &lt;/update&gt;
    &lt;update id="updateByExample" parameterType="map" &gt;
      &lt;!--
        WARNING - @mbggenerated
        This element is automatically generated by MyBatis Generator, do not modify.
        This element was generated on Tue Jun 17 09:23:52 CEST 2014.
      --&gt;
      update contact
      set CONTACT_ID = #{record.CONTACT_ID,jdbcType=INTEGER},
        CONTACT_EMAIL = #{record.CONTACT_EMAIL,jdbcType=VARCHAR},
        CONTACT_NAME = #{record.CONTACT_NAME,jdbcType=VARCHAR},
        CONTACT_PHONE = #{record.CONTACT_PHONE,jdbcType=VARCHAR}
      &lt;if test="_parameter != null" &gt;
        &lt;include refid="Update_By_Example_Where_Clause" /&gt;
      &lt;/if&gt;
    &lt;/update&gt;
    &lt;update id="updateByPrimaryKeySelective" parameterType="test.model.Customer" &gt;
      &lt;!--
        WARNING - @mbggenerated
        This element is automatically generated by MyBatis Generator, do not modify.
        This element was generated on Tue Jun 17 09:23:52 CEST 2014.
      --&gt;
      update contact
      &lt;set &gt;
        &lt;if test="CONTACT_EMAIL != null" &gt;
          CONTACT_EMAIL = #{CONTACT_EMAIL,jdbcType=VARCHAR},
        &lt;/if&gt;
        &lt;if test="CONTACT_NAME != null" &gt;
          CONTACT_NAME = #{CONTACT_NAME,jdbcType=VARCHAR},
        &lt;/if&gt;
        &lt;if test="CONTACT_PHONE != null" &gt;
          CONTACT_PHONE = #{CONTACT_PHONE,jdbcType=VARCHAR},
        &lt;/if&gt;
      &lt;/set&gt;
      where CONTACT_ID = #{CONTACT_ID,jdbcType=INTEGER}
    &lt;/update&gt;
    &lt;update id="updateByPrimaryKey" parameterType="test.model.Customer" &gt;
      &lt;!--
        WARNING - @mbggenerated
        This element is automatically generated by MyBatis Generator, do not modify.
        This element was generated on Tue Jun 17 09:23:52 CEST 2014.
      --&gt;
      update contact
      set CONTACT_EMAIL = #{CONTACT_EMAIL,jdbcType=VARCHAR},
        CONTACT_NAME = #{CONTACT_NAME,jdbcType=VARCHAR},
        CONTACT_PHONE = #{CONTACT_PHONE,jdbcType=VARCHAR}
      where CONTACT_ID = #{CONTACT_ID,jdbcType=INTEGER}
    &lt;/update&gt;
  &lt;/mapper&gt;
  </code></pre>
  
  <hr>
  
  <pre class="lang-none prettyprint-override"><code>log4j:WARN No appenders could be found for logger (org.apache.ibatis.logging.LogFactory).
  log4j:WARN Please initialize the log4j system properly.
  log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
  Exception in thread "main" org.apache.ibatis.exceptions.PersistenceException: 
  ### Error updating database.  Cause: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for Customer.updateByPrimaryKeySelective
      ### Cause: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for Customer.updateByPrimaryKeySelective
  at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:26)
  at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:154)
  at test.dao.CustomerDAO.updateByPrimaryKeySelective(CustomerDAO.java:91)
  at test.trial.main.main(main.java:27)
      Caused by: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for Customer.updateByPrimaryKeySelective
  at org.apache.ibatis.session.Configuration$StrictMap.get(Configuration.java:797)
  at org.apache.ibatis.session.Configuration.getMappedStatement(Configuration.java:631)
  at org.apache.ibatis.session.Configuration.getMappedStatement(Configuration.java:624)
  at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:151)
  ... 2 more
  </code></pre>