java - ModelMapper 无法将 java.util.List 转换为 java.util.List
问题描述
我尝试使用 ModelMapper 将 @Entity 转换为 DTO,因此出现此错误:
org.modelmapper.MappingException: ModelMapper mapping errors:
1) Converter org.modelmapper.internal.converter.CollectionConverter@f3e6876 failed to convert java.util.List to java.util.List.
1 error
有人可以帮助我吗?
解决方案
真正的问题是:
Caused by: org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: com.example.backapi.aviso.domain.Aviso.links, could not initialize proxy - no Session
解决方法:
@ElementCollection(fetch = FetchType.LAZY)
推荐阅读
- r - R 语言:在 SQL 语句中使用 UDF
- sql - PostgreSQL 查询基于字符串进行拆分并将它们连接到新的单独列中
- ios - tableView 在其父视图居中时不会出现
- php - 在 Woocommerce 中隐藏特定用户角色的特定运输方式
- oracle - Oracle SQL Developer 是否与 sqlnet.ora 一起使用?
- excel - 运行时错误 1004 - 复制所选工作表失败
- python - Pandas - 列标题到行值
- c# - 在 timer_tick 期间更新文本框
- sql - 每个唯一行的 Oracle LAG 函数
- javascript - 比较两个对象的年龄较大的Javascript函数