Cause: org.apache.ibatis.reflection.ReflectionException: Could not set property 'orderdetails' of 'class com.luchao.mybatis.first.po.Orders' with value 'Orderdetail [id=null, ordersId=3, itemsId=1, it


从上面异常的解释来看是因为反射不能将Orders设置到orderdetails属性上,仔细检查了MyBatis的配置文件,发现:

1 <collection property="orderdetails" javaType="com.luchao.mybatis.first.po.Orderdetail">
2             <result column="id" property="id"/>
3             <result column="items_id" property="itemsId"/>
4             <result column="items_num" property="itemsNum"/>
5             <result column="orders_id" property="ordersId"/>
6 </collection>

上面的javaType属性的问题,因为这个是一对多,通过反射应该映射为List,但是使用javaType会让MyBatis认为orderdetails属性为Orderdetail,所以出错,将javaType改为ofType,只是指定泛型的类型为Orderdetail。


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



猜您在找 Error querying database. Cause: org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'ItemsCustom' in 'class com.pojo.OrderDetailCustom springboot 项目保存数据时偶然出现的异常 nested exception is org.apache.ibatis.reflection.ReflectionException: Could not set property 'id' Mybatis出错: Cause: org.apache.ibatis.reflection.ReflectionException: Error instantiating class com.cyf.pojo.User with invalid types () or values () Mybatis笔记四:nested exception is org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'id' in 'class java.lang.String' mybatis映射异常:nested exception is org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'id' in 'class java.lang.String Cause: org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'empid' in 'class cn.happy.entity.Emp' 【Mybatis】mybatis查询报错org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'areaName' in 'class java.lang.String' 已解决: mybatis报错 org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'xxx' in 'class java.lang.String' Caused by: org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'zoneId' in 'class java.lang.String' org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'parentId' in 'class java.lang.String'
 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM