I have 2 entities:
Entity 1:
public class Master {
private int id;
private Set<SubMaster> subMasters= new HashSet<SubMaster>(0);
}
public class SubMaster{
private int subId;
private String subName;
}
Entity 2:
public class MasterDTO {
private int id;
private Set<SubMaster> subMasters= new HashSet<SubMaster>(0);
}
public class SubMasterDTO{
private int subId;
private String subName;
}
I am using MapStruct Mapper to map values of POJO to another.
public interface MasterMapper{
MasterDTO toDto(Master entity);
}
I am able to successfully map Master
to MasterDTO
. But, the nested collection of SubMaster
in Master
is not getting mapped to its counterpart in MasterDTO
.
Could anyone help me in right direction?