tenwit wrote:
Hibernate does not support subqueries in the from clause.
Your SQL will produce a two column result set, in which the first column is the given parameter (always the same), and the second column is the column "table2.attr2". Why not forget the parameter, seeing as it'll always be the same, and just issue the SQL "select attr2 from table2"? That's so simple that there's no point in writing HQL for it. Just use sql-query.
Ok, my point is if I have a parameter in subselect, without native SQL, how can I make it work?
Let's change it to:
select temp.attra, temp.attrb, table3.attrx from (select table1.attra, table2.attrb as temp where table1.attrc=? and table1.attrd=table2.attre), table3 join ...