关于spring整合mybatis报错:Type handler was null on parameter mapping for property 'department'.
来源:互联网 发布:linux上传文件命令 编辑:程序博客网 时间:2024/04/29 07:53
这个错误的原因就是,你要传递的参数已经在mybatis文件中配置过了,而传递参数时又用的这个名字所以解析时出错。
例如我的resultMap中已经配置了userId,这是一个对象
<resultMap id="userDynamicMap" type="UserDynamicTO">
<result property="income" column="INCOME"/>
<association property="userId" javaType="UserTO">
<id property="id" column="ID"/>
</association>
</resultMap>
但是在参数表示时,我这表示的是主键id,而不是一个对象,所以要把#{userId}改成别的名字
<update id="noSpeak" parameterType="UserDynamicTO">
UPDATE USER_DYNAMIC SET FORBID_COMMIT_BEGIN_DATE = #{forbidCommitBeginDate},
FORBID_COMMIT_END_DATE = #{forbidCommitEndDate}
WHERE USER_ID = #{userId}
</update>
《================================================================================================================》
如下图所示:其实在User实体类中,我们已经把department传过去了,但是在关联表中,再一次使用department就会报错。
<insert id="add" parameterType="org.itat.model.User">
insert into t_user(username,password,nickname,department)
value(#{username},#{password},#{nickname},#{department.id});
</insert>
改正后应该为:《红色部分》和数据库一致即可
<insert id="add" parameterType="org.itat.model.User">
insert into t_user(username,password,nickname,dep_id)
value(#{username},#{password},#{nickname},#{department.id});
</insert>
- 关于spring整合mybatis报错:Type handler was null on parameter mapping for property 'department'.
- 关于mybatis的传递参数报错Type handler was null on parameter mapping for property 'userId'.
- 关于 mybatis 中Type handler was null on parameter mapping for property '__frch_id_0'类似的错误
- Type handler was null on parameter mapping for property '__frch_id_0'
- Type handler was null on parameter mapping for property '__frch_uid_0'
- Type handler was null on parameter mapping for property '__frch_productId_0'. It was either not spec
- mybatis-spring整合报错
- spring和mina2集成报错Cannot convert value of type ..for property 'customEditors..PropertyEditor.
- Spring Data JPA 报错 :PropertyReferenceException: No property params found for type xxx!
- 在mybatis报错Open quote is expected for attribute "property" associated with an element type "result".
- No property toPredicate found for type User!报错
- Hibernate配置文件报错:The content of element type "session-factory" must match "(property*,mapping*,(c
- spring 3.2+mybatis 整合报错问题
- MyEclipse上整合spring,mybatis报错
- mybatis整合spring过程中的报错
- 关于Hibernate中的int和float数据及Null value was assigned to a property of primitive type setter of
- 日常-关于“Cannot read property 'length' of null”报错
- spring,mybatis整合报错Result Maps collection already contains value for ...BaseResultM
- 杭电1014 ——Uniform Generator
- (转)对cloneable接口跟Object.clone方法的理解
- 虽然我不是windows端程序员,但是这个IOCP讲的还是可以的
- Intellij IDEA快捷键与使用技巧
- cookie 和session 的区别详解
- 关于spring整合mybatis报错:Type handler was null on parameter mapping for property 'department'.
- [POJ1459]Power Network 做题笔记
- leetcode:First Missing Positive 【Java】
- 样式叠加不知道什么原因;
- 触摸事件
- hdu 1593(数学)
- 关于IList、IQueryable、IEnumerable与Func、Expression的关系
- VNC 登录上去灰屏,没有shell脚本,鼠标变成X
- linux下使用编译使用GeoIp 出现问题