I have a multitable SQL that I am running in a SQLQuery, such as:
SQLQuery query = currentSession().createSQLQuery(sql.toString());
List confResults = query.list();
This naturally brings back Object[] but I would like to have my results in a DTO so I can quickly get them out by name. So I changed my SQL to be like this:
SELECT new myDTO(/*+ rule */ a.field1, a.field2,a.field3, a.field4, b.field1, b.field2 ) FROM tableA a, tableB b WHERE a.id = b.id(+) AND <more parameters here>
However, when I execute query.list I get the error:
Caused by: java.sql.SQLException: ORA-00923: FROM keyword not found where expected
My DTO is just a bean, so I don’t that is it. If I take out the “new myDTO(…)” then it runs, returning Object[].
Any ideas why this doesn’t work?