---
title: "org.apache.ibatis.executor.ExecutorException: There was no TypeHandler found for"
author: "cline"
date: "2012-05-15T16:38:37Z"
tags: ["MyBatis", "executorexception", "typeHandler"]
categories: ["编程语言"]
slug: "org-apache-ibatis-executor-executorexception-there-was-no-typehandler-found-for"
draft: false
lastmod: "2012-05-15T16:38:37Z"
id: 1530726
url: "https://hussion.iteye.com/blog/1530726"
---

对于\[color=red]org.apache.ibatis.executor.ExecutorException: There was no TypeHandler found for parameter...\[/color]这个异常，是由于javaType和jdbcType的类型不匹配造成的。 \[code="xml"] insert into t\_message(id,content,createtime,t\_student\_id,t\_class\_id) values(#{id},#{content},#{createTime},#{student},#{class}) \[/code] \[color=green] 我的数据库里，t\_student\_id和t\_class\_id是varchar类型，Message里面有student和class对象，所以直接按上面方案配置，就会报typehandler异常，解决方法也很简单: \[/color] \[code="xml"] insert into t\_message(id,content,createtime,t\_student\_id,t\_class\_id) values(#{id},#{content},#{createTime},#{student.id},#{class.id}) \[/code] \[color=red]用直接类似EL表达式的方式即可绑定你想给定的数据类型 !\[/color]