mybatis 报错There is no getter for property named 'XXX' in 'class com.xx.xx'

mybatis报错信息记录:

### Error querying database.  Cause: org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'batchDetails' in 'class com.mybatis.model.Batch'

### Error querying database.  Cause: org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'batchDetails' in 'class com.mybatis.model.Batch'

这个问题会气死人,单词写错了

      <collection property="batchList" ofType="com.mybatis.model.Batch">
            <id column="batch_id" property="batch_id"/>
            <result column="cus_id" property="cus_id"/>
            <result column="number" property="number"/>
            <result column="createtime" property="createtime" javaType="java.util.Date"/>
            <result column="note" property="note"/>
            <!--订单(批次)明细-->
            <collection property="batchDetails" ofType="com.mybatis.model.BatchDetail">
                <id column="id" property="id"/>
                <result column="batch_id" property="batch_id"/>
                <result property="product_id" column="product_id"/>
                <result property="product_num" column="product_num"/>
                <!--每个明细对应单独(一对一)的说明-->
                <association property="finacialProduct" javaType="com.mybatis.model.FinacialProduct">
                    <id column="product_id" property="id"/>
                    <result column="name" property="name"/>
                    <result column="price" property="price"/>
                    <result column="detail" property="detail"/>
                </association>
            </collection>
        </collection>

其中第八行的<collection property="batchDetails",要对应第一行的ofType="com.mybatis.model.Batch">

Bath.java中的字段

public class Batch {
    private int batch_id;
    private int cus_id;
    private String number;
    private Date createtime;
    private String note;
    private List<BatchDetail> batchDetials;
}

这边写的是batchDetials

batchDetials和batchDetails

 

此类报错和描述的一样,就是找不到,可以全局搜索找一下报错的字段等方法来测试

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值