异常org.apache.ibatis.executor.ExecutorException: There was no TypeHandler found for parameter..
2017-08-07 12:28
1301 查看
是由于javaType和jdbcType的类型不匹配造成的.
通俗点讲,是你的SQL有问题。
出现异常的原代码
修改后代码
Mybatis查询实例,sql中的in在Mybatis中怎么写–以list为查询条件
通俗点讲,是你的SQL有问题。
出现异常的原代码
<select id="getMyNoticesNotPage" resultMap="BaseResultMap" parameterType="com.qskj.tzkw_oa_application.document.domain.DocuInfoVo2" > SELECT recv.ID, recv.PID, recv.SEND_USRID, recv.SEND_USRNAM, recv.RECV_USRID, recv.RECV_USRNAM, recv.READ_FLAG, recv.READ_TIME, recv.RECV_DEPTID FROM qs_tzkw_flw_docu_recv recv left join qs_tzkw_rms_user_info user on user.id = recv.RECV_USRID where user.id = #{userId} <if test="isLead !=null and isLead !=''"> and recv.RECV_DEPTID in ( #{depts} ) //如果depts是集合,不可以用${depts} </if> </select>
修改后代码
<select id="getMyNoticesNotPage" resultMap="BaseResultMap" parameterType="com.qskj.tzkw_oa_application.document.domain.DocuInfoVo2" > SELECT recv.ID, recv.PID, recv.SEND_USRID, recv.SEND_USRNAM, recv.RECV_USRID, recv.RECV_USRNAM, recv.READ_FLAG, recv.READ_TIME, recv.RECV_DEPTID FROM qs_tzkw_flw_docu_recv recv left join qs_tzkw_rms_user_info user on user.id = recv.RECV_USRID where user.id = #{userId} <if test="isLead !=null and isLead !=''"> and recv.RECV_DEPTID in <foreach collection="depts" item="item" index="index" open="(" separator="," close=")"> #{item} </foreach> </if> </select>
Mybatis查询实例,sql中的in在Mybatis中怎么写–以list为查询条件
//在service中把参数放到HashMap中 List<String> list = new ArrayList<String>(); list.add("x"); list.add("y"); list.add("z"); String s = "A" Date d = new Date(); HashMap<String,Object> param = new HashMap<String,Object>(); param.put("list",list); param.put("s",s); param.put("d",d); XXXDao.queryXXX(param); //在Mybatis的Mapper中是这么写: <select id = "queryXXX",resultType = "XXX", paramterType = "java.lang.HashMap"> select * from tab where zi_duan1 = #{s} and zi_duan2 = #{d} and zi_duan3 in <foreach item="item" index="index" collection="list" open="(" separator="," close=")"> #{item} </foreach> </select>
相关文章推荐
- org.apache.ibatis.executor.ExecutorException: A query was run and no Result Maps were found for the
- org.apache.ibatis.executor.ExecutorException: A query was run and no Result Maps were found for the
- 异常:There was no TypeHandler found for parameter id of statement
- Spring+Mybatis 查询所有数据时发生异常:org.apache.ibatis.reflection.ReflectionException: There is no getter for
- org.apache.mina.core.session.UnknownMessageTypeException: No handler found for message type:
- mybatis 异常信息 org.apache.ibatis.reflection.ReflectionException: There is no getter for property named
- org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'xx'的问题
- org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'id' in 'cla
- nested exception is org.apache.ibatis.reflection.ReflectionException: There is no getter for propert
- org.apache.ibatis.executor.ExecutorException: No constructor found in com.contentsales.meta.User
- Mybatis异常-java.lang.IllegalArgumentException: No enum constant org.apache.ibatis.type.JdbcType.NUMBE
- org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'telOrName'
- Cause: org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'user
- org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'xxx' in
- org.apache.ibatis.reflection.ReflectionException: There is no getter for property named
- org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'id' in 'cla
- Mybatis异常--java.lang.IllegalArgumentException: NO ENUM const class org.apache.ibatis.type.JdbcType.int
- org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'agoTime' in
- org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'userIds' in
- mybatis异常:org.apache.ibatis.binding.BindingException: Parameter 'param' not found. Available param