在练习MyBatis延迟加载时报错:Cause: org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'orderList' in 'class com.langsin.bean.UserVO'
我的解决方法:
1、确保UserVO类中有一个public的 getter 方法,并且方法名规范。
2、检查 MyBatis 的映射xml文件,确保在 <resultMap> 标签中引用的属性名与 Java 类中的 getter 方法名匹配。
3、发现一行代码
<collection property="orderList" ofType="orders"> 命名与我的UserVO类中ordersList属性名有出入,修改为:
<collection property="ordersList" ofType="orders"> 问题解决