-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: EJB-QL help
PostPosted: Thu Nov 30, 2006 4:52 pm 
Regular
Regular

Joined: Thu Jul 29, 2004 11:55 pm
Posts: 75
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?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.