Is it possible to initialize multiple objects in a single query? I'm trying to introduce mapping of multiple attributes to corresponding DTOs, but am getting syntax error. The query is as follows:
em.createQuery("SELECT "
+ "new com.x.y.z(fte.attr1 "
+ "fte.attr2, fte.attr3),"
+ "new com.x.y.a(fet.attr4, fet.attr5,"
+ "fet.attr6, fet.attr7, fet.attr8, fet.attr9), "
+ "new com.x.y.b(fte.attr10,"
+ " fte.attr11, fte.attr12, fte.attr13, fte.attr14), "
+ "new com.x.y.c(fte.attr15, "
+ "fte.attr16, v.attr17, v.attr18) "
+ "FROM Table1 fte "
+ "LEFT JOIN Table2fet ON fte.attr1= fet.attr1 AND fte.attr1= fet.attr1"
+ "LEFT JOIN Table3 v ON v.attr1= fte.attr1"
+ "WHERE fte.attr1= :attr1 AND fte.attr1= :attr1",
Object[].class)
.getResultStream()
however the JPA indicates a problem org.hibernate.hql.internal.ast.QuerySyntaxException: unexpected token: , near line 1, column 115 which is resolved into new com.x.y.a
location