账号密码登录
微信安全登录
微信扫描二维码登录

登录后绑定QQ、微信即可实现信息互通

手机验证码登录
找回密码返回
邮箱找回 手机找回
注册账号返回
其他登录方式
分享
  • 收藏
    X
    Type handler was null on parameter mapping for property "xx"
    62
    0

    问题描述

    mapper.xml出现错误:Type handler was null on parameter mapping for property 'category'. It was either not specified and/or could not be found for the javaType (com.yykh.onemall.pojo.Category) : jdbcType (null) combination.

    相关代码

    mapper.xml:

    <?xml version="1.0" encoding="UTF-8" ?>
    <!DOCTYPE mapper
            PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
            "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
    <mapper namespace="com.yykh.onemall.mapper.ProductMapper">
     
        <resultMap id="Product"  type="com.yykh.onemall.pojo.Product">
            <id column="id" property="id"/>
            <result property="name" column="name"/>
            <result property="subTitle" column="subTitle"/>
            <result property="originalPrice" column="originalPrice"/>
            <result property="promotePrice" column="promotePrice"/>
            <result property="stock" column="stock"/>
            <result property="createDate" column="createDate"/>
            <association property="category"   javaType="com.yykh.onemall.pojo.Category">
                <id column="cid" property="id"/>
            </association>
        </resultMap>
     
        <select id="findOne" resultMap="Product">
          SELECT * from product where id =#{id}
        </select>
     
        <select id="findAll" resultMap="Product">
            select * from product where cid =#{id}
        </select>
     
    </mapper>

    pojo:

    @Data
    public class Product {
        int id;
        private Category category;
        private String name;
        private String subTitle;
        private float originalPrice;
        private float promotePrice;
        private int stock;
        private Date createDate;
    }

    mapper.interface:

    public interface ProductMapper {
     
        @Insert("insert into product(name,subTitle,originalPrice,promotePrice,stock,createDate,category) values(#{name},#{subTitle},#{originalPrice},#{promotePrice},#{stock},#{createDate},#{category}) ")
        void save(Product bean);
     
        @Delete("delete from product where id =#{id}")
        void delete(int id);
     
     
        Product findOne(int id);
     
     
        Page<Product> findAll(Category category);
     
    }
    1
    打赏
    收藏
    点击回答
    您的回答被采纳后将获得:提问者悬赏的 11 元积分
        全部回答
    • 0
    • ↗陌语 普通会员 1楼
      502 Bad Gateway

      502 Bad Gateway


      nginx
    更多回答
    扫一扫访问手机版
    • 回到顶部
    • 回到顶部