-->
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: FROM SQL TO HQL
PostPosted: Mon Apr 28, 2008 6:08 am 
Newbie

Joined: Mon Apr 28, 2008 6:02 am
Posts: 3
hI every body i have a "little " problem with a hql code . i want to "traslate" a sql code to hql

Code:

SELECT
   ID ID_JOB,
   SEQ ID,
   (SELECT DISTINCT VALUE JOB_GROUP FROM DC_LOGGING WHERE ID = AA.ID AND SEQ = AA.SEQ AND POS = AA.POS AND NAME = 'JOB_GROUP') JOB_GROUP,
   (SELECT DISTINCT VALUE JOB_NAME FROM DC_LOGGING WHERE ID = AA.ID AND SEQ = AA.SEQ AND POS = AA.POS AND NAME = 'JOB_NAME') JOB_NAME, 
   AGENT HOST,
   TIME START_DATE,
   (SELECT DISTINCT VALUE RETRY FROM DC_LOGGING WHERE ID = AA.ID AND SEQ = AA.SEQ AND POS = AA.POS AND NAME = 'RETRY') RETRY,
   TYPE,
   TYPE_DESCRIPTION,
   ERR ERROR,
   ERROR_DESCRIPTION,
   (SELECT DISTINCT VALUE MESSAGE FROM DC_LOGGING WHERE ID = AA.ID AND SEQ = AA.SEQ AND POS = AA.POS AND NAME = 'MESSAGE') MESSAGE

   FROM
   (SELECT DISTINCT A.ID, A.SEQ, A.POS, A.AGENT, A.TIME, A.TYPE, T.DESCRIPTION TYPE_DESCRIPTION, ERR,
   E.DESCRIPTION ERROR_DESCRIPTION FROM DC_LOGGING A, DC_LOG_TYPE T, DC_ERRORS E
   WHERE A.ID = 66656 AND A.POS = 'T' AND A.TYPE = T.ID_LOG_TYPE AND A.ERR = E.ID) AA ORDER BY SEQ


the problem is ...
Code:
....
FROM
   (SELECT DISTINCT A.ID, A.SEQ, A.POS, A.AGENT, A.TIME, A.TYPE, T.DESCRIPTION TYPE_DESCRIPTION, ERR,
   E.DESCRIPTION ERROR_DESCRIPTION FROM DC_LOGGING A, DC_LOG_TYPE T, DC_ERRORS E
   WHERE A.ID = 66656 AND A.POS = 'T' AND A.TYPE = T.ID_LOG_TYPE AND A.ERR = E.ID) AA ORDER BY SEQ

i dont know how to do "(select from(select...)"
thanks...


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.