jQuery in Action, 2nd edition*
The moose likes Object Relational Mapping and the fly likes converting sql query to hql Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "converting sql query to hql" Watch "converting sql query to hql" New topic
Author

converting sql query to hql

Steven Adams
Greenhorn

Joined: Feb 05, 2009
Posts: 1
Hi,
I'd like to convert the following query to hql...
Anyone knows?
It's pretty complicated!
Thanks,
Steve

SELECT DISTINCT
a.*
, NVL(b.COL1, 0) AS WORKING
, NVL(c.COL2, 0) AS RECRUITED
, NVL(d.COL3, 0) AS FIRED
FROM PM_CATEGORY a
LEFT OUTER JOIN (SELECT CATEGORY_ID,
COUNT(*) OVER (PARTITION BY CATEGORY_ID, TRE_NODE_ID3) AS COL1
FROM EM_EMPL_FILE
WHERE TRE_NODE_ID3 = 1
) b ON a.ID = b.CATEGORY_ID
ORDER BY 1
 
 
subject: converting sql query to hql