错误代码:
Could not set property 'categoryType ' of 'class com.cyg.dataobject.ProductCategory' with value '1' Cause: org.apache.ibatis.reflection.ReflectionException: There is no setter for property named 'categoryType ' in 'class com.cyg.dataobject.ProductCategory'
Could not set property 'categoryType ' of 'class com.cyg.dataobject.ProductCategory' with value '1' Cause: org.apache.ibatis.reflection.ReflectionException: There is no setter for property named 'categoryType ' in 'class com.cyg.dataobject.ProductCategory'
There is no setter for property named 'categoryType ' in 'class com.cyg.dataobject.ProductCategory'
错误原因: 在属性'categoryType '这里多出了一个空格
配置文件
<resultMap id="BaseResultMap" type="com.cyg.dataobject.ProductCategory"> <id column="category_id" property="categoryId" jdbcType="INTEGER" /> <id column="category_name" property="categoryName" jdbcType="VARCHAR" /> <id column="category_type" property="categoryType " jdbcType="INTEGER" /> </resultMap>
配置文件中可以看出设置属性时多了个空格
property="categoryType "修改后就正确了,所以写这些东西要仔细.