1.6.1
Enhancements
- Use Java
LinkedHashSetandLinkedHashMapnew factory method with known capacity when on Java 19 or later (#3113)
Bugs
- Inverse Inheritance Strategy not working for ignored mappings only with target (#3652)
- Inconsistent ambiguous mapping method error when using
SubclassMapping: generic vs raw types (#3668) - Fix regression when using
InheritInverseConfigurationwith nested target properties and reversingtarget = "."(#3670) - Deep mapping with multiple mappings broken in 1.6.0 (#3667)
- Two different constants are ignored in 1.6.0 (#3673)
- Inconsistent ambiguous mapping method error: generic vs raw types in 1.6.0 (#3668)
- Fix cross module records with interfaces not recognizing accessors (#3661)
@AfterMappingmethods are called twice when using target with builder (#3678)- Compile error when using
@AfterMappingmethod with Builder and TargetObject (#3703)
Behaviour change
Inverse Inheritance Strategy not working for ignored mappings only with target
Prior to this fix @Mapping(target = "myProperty", ignore = true) was being ignored when using @InheritInverseConfiguration.
e.g.
@Mapper
public interface ModelMapper {
@Mapping(target = "creationDate", ignore = true)
Entity toEntity(Model model);
@InheritInverseConfiguration
Model toModel(Entity entity);
}
In the example above prior 1.6.1 the Model toModel(Entity entity) was going to map the id property. In order to keep that behavior you'll need to explicitly do the mapping for it.
@Mapper
public interface ModelMappe {
@Mapping(target = "creationDate", ignore = true) // NOTE: Handled by JPA.
Entity toEntity(Model model);
@InheritInverseConfiguration
@Mapping(target = "creationDate", source = "creationDate") // Allow reading from Entity
Model toModel(Entity entity);
}