Mybatis - 嵌套的延迟加载结果属性在结果映射问题上已经存在

Mybatis - nested lazy loaded result property is already exist on result map issue

提问人:Inked 提问时间:10/3/2023 最后编辑:Inked 更新时间:10/3/2023 访问量:25

问:

我打算将弹簧从 4 升级到 5 因此,我需要将mybatis从2升级到3.5.11

在升级 mybatis 时,我遇到了这个问题,这对我来说是不清楚的。

我得到以下错误-

 nested exception is org.apache ibatis:executor ExecutorException:
 Nested lazy loaded result property "xyz” for  “com.xyz.ApplicationMybatisDaogetbyName” already exists in the result  map. The leftmost property of al lazy loaded properties must be unique within a result map.

但是我检查了我的 mybatisDao xml ,只有一次被提及:

同样的事情在旧版本的mybatis中也有效。

这个问题似乎发生在使用关联时,但不确定。

我将关联用作:

属性:xyz,列:列名 ,选择:com.xyz.ApplicationMybatisDaogetbyName

我尝试添加sql会话bean的属性 -

configuration.setLazyLoadingEnabled(false); configuration.setAggressiveLazyLoading(false); configuration.setReturnInstanceForEmptyRow(true);

但它没有奏效。

任何避免此问题的线索将不胜感激

mybatis mybatis-mapper mybatis-plus

评论

0赞 ave 10/3/2023
我们基本上需要信息来重现我们这边的相同问题。你能提供一个小项目来重现这个问题吗?以下是一些项目模板和示例。请不要包含 mybatis-plus(如果是 MyBatis 问题,应该在没有 mybatis-plus 的情况下复制)。

答: 暂无答案