`

org.apache.ibatis.executor.ExecutorException: There was no TypeHandler found for

阅读更多
对于org.apache.ibatis.executor.ExecutorException: There was no TypeHandler found for parameter...这个异常,是由于javaType和jdbcType的类型不匹配造成的。

<insert id="add" parameterType="Message">
        insert into t_message(id,content,createtime,t_student_id,t_class_id)
        values(#{id},#{content},#{createTime},#{student},#{class})
</insert>



我的数据库里,t_student_id和t_class_id是varchar类型,Message里面有student和class对象,所以直接按上面方案配置,就会报typehandler异常,解决方法也很简单:


<insert id="add" parameterType="Message">
        insert into t_message(id,content,createtime,t_student_id,t_class_id)
        values(#{id},#{content},#{createTime},#{student.id},#{class.id})
</insert>


用直接类似EL表达式的方式即可绑定你想给定的数据类型 !
分享到:
评论

相关推荐

    ibatis-core-3.0.jar org.apache.ibatis.annotations.Param

    `org.apache.ibatis.annotations.Param`是MyBatis中的一个重要注解,用于处理方法参数映射。 `@Param`注解主要用于SQL查询中的动态参数绑定,尤其是在动态SQL语句中。在MyBatis的映射文件或者Mapper接口中,当我们...

    ibatis-2.3.4.726.jar,ibatis-2.3.0.677.jar,ibatis-2.3.3.720.jar下载

    iBATIS,全称为“Infrastructure for Binding Applications To SQL Maps”,是一个优秀的开源持久层框架,它允许Java开发者将SQL语句与Java代码分离,提供了一种简单但强大的在Java应用中映射SQL和结果集的方式。...

    Mybatis报错: org.apache.ibatis.exceptions.PersistenceException解决办法

    在使用Mybatis框架时,你可能会遇到`org.apache.ibatis.exceptions.PersistenceException`这样的异常。这个异常通常表示在执行数据库查询操作时遇到了问题。本篇将详细分析这个问题并提供解决方法。 ### 问题概述 ...

    前端-后端java的Util类的工具类

    │ │ │ frame-sourcefiles-org.apache.ibatis.executor.loader.cglib.html │ │ │ frame-sourcefiles-org.apache.ibatis.executor.loader.html │ │ │ frame-sourcefiles- org.apache.ibatis.executor.loader...

    mybatis源码中文注释.zip

    org.apache.ibatis.logging org.apache.ibatis.logging.commons org.apache.ibatis.logging.jdbc org.apache.ibatis.logging.jdk14 org.apache.ibatis.logging.log4j org.apache.ibatis.logging.log4j2 org.apache....

    iBatis框架搭建用到的所有jar包

    纵观目前主流的 ORM(对象关系映射),无论 Hibernate还是Apache OJB,都对数据库结构提供了较为完整的封装,提供了从POJO到数据库表的全套映射机制。程序员往往只需定义好了POJO 到数据库表的映射关系,即可通过 ...

    apache开源项目源码ibatis-3-core-src-3.0.0.227(ibatis框架java源程序)

    apache开源项目源码ibatis-3-core-src-3.0.0.227 ibatis框架java源程序 spring,struts,hibernate,ibatis,框架源码 各种ibatis框架应用源码,你会从中得到意想不到的效果! apache开源组织开发的开源项目源码,其...

    IBATISJDBC包

    1. **IBATIS核心库**: 包含了ibatis-2.x.jar,这是IBATIS框架的主要实现,提供了SQL映射文件解析、事务管理、结果集处理等功能。 2. **JDBC驱动**: 根据实际使用的数据库类型,如MySQL、Oracle、SQL Server等,需要...

    mybaits refid patch

    Caused By: org.apache.ibatis.builder.BuilderException: Could not find SQL statement to include with refid 'SAD02.SAD02_COL' at org.apache.ibatis.builder.xml.XMLStatementBuilder$IncludeNodeHandler....

    IBatisNet.Common.1.6.2、IBatis.DataAccess.1.9.2、IBatis.DataMapper.1.6.2

    标题和描述中提到的"IBatisNet.Common.1.6.2、IBatis.DataAccess.1.9.2、IBatis.DataMapper.1.6.2"是针对一个名为IBatisNet的框架的不同组件的版本号。IBatisNet是一个在.NET平台上实现的开源持久层框架,它源于Java...

    ibatis最新包下载

    要大于20个字符要大于20个字符要大于20个字符要大于20个字符要大于20个字符要大于20个字符要大于20个字符要大于20个字符要大于20个字符

    spring lib j2ee

    log4j.addivity.org.apache=true log4j.logger.com.ibatis = ERROR log4j.logger.com.ibatis.common.jdbc.SimpleDataSource = ERROR #log4j.logger.com.ibatis.common.jdbc.ScriptRunner = ERROR #log4j....

    Spring高版本对ibatis的支持

    &lt;bean id="sqlMapClient" class="org.springframework.orm.ibatis.SqlMapClientFactoryBean"&gt; &lt;value&gt;classpath:SqlMapConfig.xml &lt;bean id="dao" class="org.springframework.orm.ibatis....

    ibatis源码,ibatis源码 ibatis源码 ibatis源码

    在`org.apache.ibatis.executor.statement.StatementHandler`中,我们可以看到如何根据不同的数据库驱动创建Statement,以及如何绑定参数到Statement中。 五、ResultSetHandler与ResultMap ResultSetHandler处理...

    mybatis-3-mybatis-3.2.6.zip

    5. **org.apache.ibatis.executor**:执行SQL语句的组件,包括SimpleExecutor、ReuseExecutor和BatchExecutor,分别对应简单执行、重用执行和批处理执行策略。 6. **org.apache.ibatis.reflection**:反射相关的工具...

    spring-framework-3.0.5.RELEASE-dependencies-5

    org.apache.ibatis org.apache.juli 4号包: org.apache.tiles org.apache.velocity org.apache.xerces org.apache.xml org.apache.xmlbeans org.apache.xmlcommons org.apache.derby org.apache.poi org.apache....

    spring-framework-3.0.5.RELEASE-dependencies-1

    org.apache.ibatis org.apache.juli 4号包: org.apache.tiles org.apache.velocity org.apache.xerces org.apache.xml org.apache.xmlbeans org.apache.xmlcommons org.apache.derby org.apache.poi org.apache....

    mybatis-3.1.1.jar

    - org.apache.ibatis.executor 包:执行器相关的类。 - org.apache.ibatis.builder 包:用于构建SqlSessionFactory的类。 - org.apache.ibatis.mapping 包:关于映射器和结果映射的类。 - org.apache.ibatis.type 包...

Global site tag (gtag.js) - Google Analytics