Dear Folks!
I searched the web and the forum and I did not find an answer if the following query is possible (Simplified)
Domain Model:
Code:
public class Entity {
private Long Id;
private String prop1;
private String prop2;
}
Code:
public class DTO1{
private final Long id;
public DTO1(Long id){
this.id = id;
}
}
Code:
public class DTO2{
private final String prop1;
public DTO1(String prop1){
this.prop1= prop1;
}
}
Code:
public class AggregateDTO{
private final DTO1 dto1;
private final DTO2 dto2;
public AggregateDTO(DTO1 dto1, DTO2){
this.dto1 = dto1;
this.dto2 = dto2;
}
}
I would like to execute following query:
Code:
select new AggregateDTO(new DTO1(e.id), new DTO2(e.prop1))
FROM Entity e
I get the errormessage 'unexpected token new'.
I found a ticket to this topic since 2004. Is this feature still open, or is it already solved?
https://hibernate.onjira.com/browse/HHH-37