mybatis 引用对象属性映射错误 or could not be found for the javaType (xxx.model) : jdbcType (null) combination.
来源:互联网 发布:荷塘月色淘宝论坛上 编辑:程序博客网 时间:2024/05/29 04:08
宽为限 紧用功 工夫到 滞塞通
使用mybatis框架时遇到的一个错误,记录一下
org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. Cause: java.lang.IllegalStateException: Type handler was null on parameter mapping for property ‘productType’. It was either not specified and/or could not be found for the javaType (xxx.pojo.ProductType) : jdbcType (null) combination.
错误信息是mybatis没找到对应的jdbcTye,这里我就纳闷了,好好的对象怎么会需要映射了?以前都不用的啊???
打开该报错类的配置文件和实体类看看
productMain.xml
... <resultMap type="product" id="productMap"> ... <association property="productType" column="product_type" select="xxx.mapper.ProductTypeMapper.getById" /> </resultMap> ...
ProductMain.java
... /** * 商品分类 */ private ProductType productType; public ProductType getProductType() { return productType; } public void setProductType(ProductType productType) { this.productType = productType; }...
没发现什么毛病,productType 类型是这样的,,
看到javaType (xxx.pojo.ProductType)
这个错好像发现了什么,,好端端的怎么突然要映射了呢? 莫非它不是一个属性了?,,,突然想起这个,别名!!!
sqlMapConfig.xml
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN" "http://mybatis.org/dtd/mybatis-3-config.dtd"><configuration> <!-- 设置 --> <settings> <!-- 这个配置使全局的映射器启用或禁用缓存 --> <setting name="cacheEnabled" value="true" /> <!-- 允许JDBC支持生成的键 --> <setting name="useGeneratedKeys" value="true" /> <!-- 配置默认的执行器 --> <setting name="defaultExecutorType" value="REUSE" /> <!-- 全局启用或禁用延迟加载 --> <setting name="lazyLoadingEnabled" value="true" /> <!-- 设置超时时间,它决定驱动等待一个数据库响应的时间 --> <setting name="defaultStatementTimeout" value="25000" /> </settings> <!-- 配置别名 --> <typeAliases> <typeAlias alias="user" type="xxx.pojo.ProductUser" /> <typeAlias alias="product" type="xxx.pojo.ProductMain" /> <typeAlias alias="productType" type="xxx.pojo.ProductType" /> <typeAlias alias="productLabel" type="xxx.pojo.ProductLabel" /> <typeAlias alias="productImage" type="xxx.pojo.ProductImage" /> </typeAliases>...
<typeAlias alias="productType" type="xxx.pojo.ProductType" /><association property="productType" column="product_type" select="xxx.mapper.ProductTypeMapper.getById" />
额,,重名了!
改一个名字重启一下就OK啦 \(^o^)/YES!
- mybatis 引用对象属性映射错误 or could not be found for the javaType (xxx.model) : jdbcType (null) combination.
- 引用DLL打包出错”But the dll is not allowed to be included or could not be found.“
- Unity发布时出现“The type or namespace name `UnityEditor' could not be found.” 错误
- Morphia @Reference 属性删除出现The reference xxx could not be fetched for 问题解决
- "The target '__Page' for the callback could not be found or did not implement ICallbackEventHandler."的解决办法
- DevExpress Exception Solution - The target "X" for the callback could not be found or did not implement ICallbackEventHandler
- mybatis 属性讲解 javaType jdbcType association
- WCF分布式开发常见错误(4):The type or namespace name 'DataContract' could not be found DataContract找不到
- 安装ADT时报Cannot complete the install because one or more required items could not be found.错误
- Application "XXX" could not be found in the registry. The applications available are: .
- mybatis jdbcType 对应javaType
- Mybatis javaType jdbcType
- Eclipse 出现Some sites could not be found. See the error log for more detail.错误 解决方法
- Eclipse 出现Some sites could not be found. See the error log for more detail.错误 解决方法
- Eclipse 出现Some sites could not be found. See the error log for more detail.错误 解决方法
- The controller for path '/favicon.ico' could not be found or it does not implement the IController interface./r/nParameter name:
- MyBatis中jdbcType和javaType的映射关系
- Application "XXX" could not be found in the registry的解决办法
- PAT题解——1071. Speech Patterns (25)
- hdu6115 最近公共祖先+树的重心优化
- 2017.8.13
- CodeBlocks的常用快捷键
- Jsp、Servlet、Action的区别
- mybatis 引用对象属性映射错误 or could not be found for the javaType (xxx.model) : jdbcType (null) combination.
- 斯坦福大学2017年春季_基于卷积神经网络的视觉识别课程视频教程及ppt分享
- 个人向的前端的坑坑洼洼的记录(1)
- Git-warning: CRLF will be replaced by LF in XXX .
- 我的React实例
- hud 2544 最短路 flyod
- Elasticsearch入门级用法
- 121. Best Time to Buy and Sell Stock
- C函数文件操作函数