Hi there.
How can I get a nested DTO from HQL ??
Is it possible to do this like that:
Code:
String query = "select new IndustryLabelDTO(label.name, label.number, (select new IndustryDTO(industry.name, industry.urlName) from Industry industry where industry.label = label)) FROM IndustryLabel label ORDER BY label.number ASC, label.name ASC";
DTOs:Code:
public class IndustryLabelDTO {
public String name;
public int number;
public List<IndustryDTO> industries = new ArrayList<IndustryDTO>();
}
public class IndustryDTO {
public String name;
public String urlName;
}
Thank you for any idea. Tomas