Is it possible to propagate value form a parent object to collection of nested objects? For example
Source DTO classes
class CarDTO {
private String name;
private long userId;
private Set<WheelDto> wheels;
};
class WheelDto {
private String name;
}
Target entity classes
class Car {
private String name;
private long userId;
private Set<Wheel> wheels;
};
class Wheel {
private String name;
private long lastUserId;
}
As you could see I do not have lastUserId on WheelDto, hence I would like to map userId from CarDto to lastUserId on WheelDto on each object in a wheels collection I tried
@Mapping(target = "wheels.lastUserId", source = "userId")
but no luck