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