I was wondering if this query can be written in EJB-QL
<code>
String query =
" SELECT" +
" CASE" +
" WHEN r.x = :p" +
" THEN r.y ELSE r.x " +
" END AS z," +
" SUM (f.value * w.weight) AS rank" +
" FROM Fact f, Factor w, Arc r" +
" WHERE" +
" (r.x = :p OR r.y=:p) AND" +
" r = f.arc AND" +
" f.m = w.m AND" +
" w.mdl = :model" +
" GROUP BY f.arc, r.x, r.y" +
" ORDER BY rank";
</code>
I get this error:
[12:44:42.656] [ERROR] [JDBCExceptionReporter] - [-4005] (at 576): Unknown column name:RANK
The sql generates correctly except that as rank is converted to as col_1_0_ but remains rank in the order by clause. How do I egt it to recognize rank as the same from the select clause? Is it possible?
|