异常显示:
--- Check the result mapping for the 'GENDER' property.
--- Cause: java.sql.SQLException: 列名无效

解决方案 »

  1.   

    看看你在JAVABEAN中GETTER和SETTER了GENDER字段没?
      

  2.   

    <typeAlias alias="author" type="com.ibatis.Author"/>  <resultMap id="authorResult" class="author">
        <result property="id" column="ID"/>
        <result property="name" column="NAME"/>
        <result property="address" column="ADDRESS"/>
        <result property="gender" column="GENDER"/>
        <result property="age" column="AGE"/>
      </resultMap>  <select id="getAllAuthor" resultMap="accountResult" >
        select $fieldname$ from author 
      </select>再检查com.ibatis.Author是否属性都对应上了。
      

  3.   

    resultMap不能动态使用,所以动态的字段查询建议用最大字段集。
      

  4.   

    to:jgawk,你说的采用最大字段集指的是什么,谢谢!
      

  5.   

    就是你调用同一个sqlmap的所有代码中出现的字段最多的字段列表。
      

  6.   

    谢谢!如果这样调用结果没问题。目前存在问题是动态sql中字段作为变量来不断变化,所以无法设定固定的字段列表。
      

  7.   

    谢谢大家了,该问题通过分析源代码后已解决。
    解决方法:请在<select id="getAllAuthor" resultClass="java.util.HashMap">
    中添加remapResults="true",即<select id="getAllAuthor"  remapResults="true" resultClass="java.util.HashMap">
      

  8.   

    remapResults="true" ?
    楼主给讲解讲解贝?