ModelMapper无法将java.util.List转换为java.util.List

时间:2019-10-05 13:34:05

标签: java spring-boot modelmapper

我尝试使用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

有人可以帮助我吗?

1 个答案:

答案 0 :(得分:0)

真正的问题是:

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)