👩💻 Join our community of thousands of amazing developers!
Use the nullValueCheckStrategy = NullValueCheckStrategy.ALWAYS) on the mapping property you want to be checked. In this snippet you can see a PostalAdress entity is mapped to an entity of the same type, but the id is overwritten only when it is present in the source: import java.time.LocalDateTime; import org.mapstruct.Mapper; import org.mapstruct.Mapping; import org.mapstruct.NullValueCheckStrategy; import com.example.entity.PostalAddress; @Mapper( componentModel = "cdi", imports = ...