0
Я следующие ФасольModelMapper - Не удалось преобразовать ArrayList в список
public class Ticket extends BaseEntity {
private ForeignCollection<TicketDetail> ticketDetails;
}
public class TicketDto extends BaseDto {
private List<TicketDetailDto> ticketDetails;
}
И я картографирование, используя ModelMapper, List<TicketDto>
к List<Ticket>
как
List<TEntity> entities = mapper.map(dtoList, new TypeToken<List<Ticket>>(){}.getType());
Но бросает следующее Исключение и Stacktrace
1) Converter [email protected] failed to convert java.util.ArrayList to java.util.ArrayList.
1 error
at org.modelmapper.internal.Errors.throwMappingExceptionIfErrorsExist(Errors.java:374)
at org.modelmapper.internal.MappingEngineImpl.map(MappingEngineImpl.java:69)
at org.modelmapper.ModelMapper.mapInternal(ModelMapper.java:497)
at org.modelmapper.ModelMapper.map(ModelMapper.java:429)
Caused by: org.modelmapper.MappingException: ModelMapper mapping errors:
1) Failed to set value '' on com.pichardo.metalesbc.infrastructure.domainentities.Ticket.setTicketDetails()
1 error
at org.modelmapper.internal.Errors.toMappingException(Errors.java:258)
at org.modelmapper.internal.PropertyInfoImpl$MethodMutator.setValue(PropertyInfoImpl.java:118)
at org.modelmapper.internal.MappingEngineImpl.setDestinationValue(MappingEngineImpl.java:250)
at org.modelmapper.internal.MappingEngineImpl.propertyMap(MappingEngineImpl.java:181)
at org.modelmapper.internal.MappingEngineImpl.typeMap(MappingEngineImpl.java:132)
at org.modelmapper.internal.MappingEngineImpl.map(MappingEngineImpl.java:101)
at org.modelmapper.internal.converter.IterableConverter.convert(IterableConverter.java:49)
at org.modelmapper.internal.MappingEngineImpl.convert(MappingEngineImpl.java:337)
at org.modelmapper.internal.MappingEngineImpl.map(MappingEngineImpl.java:96)
at org.modelmapper.internal.MappingEngineImpl.map(MappingEngineImpl.java:60)
... 50 more
Caused by: java.lang.IllegalArgumentException: argument type mismatch
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.modelmapper.internal.PropertyInfoImpl$MethodMutator.setValue(PropertyInfoImpl.java:116)
Кажется, это карта прямо из Билета -> TicketDto, но он не работает, когда TicketDto -> Ticket.
Любая помощь очень ценится.