Skip to Main Content

Integration

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Calculating working hours to hibernate query

user13055307Apr 29 2010 — edited Apr 29 2010
Hello,

How to i convert this into Hibernate Nativesql query
SELECT sql_calc_found_rows                                          gstime, 
       MAX(stoptime)                                                AS mx, 
       MIN(starttime)                                               AS mn, 
       Sec_to_time(SUM(Time_to_sec(Timediff(stoptime, starttime)))) AS totalworktime 
FROM   (SELECT gstime, 
               gstime                                               AS stoptime, 
               Coalesce((SELECT MAX(b.gstime) 
                         FROM   xydata b 
                         WHERE  objectid = '17' 
                                AND clientid = '1' 
                                AND gstime > '2010-04-20 08:22:27' 
                                AND gstime < '2010-04-26 10:22:27' 
                                AND b.objectid = a.objectid 
                                AND b.gstime < a.gstime), gstime) AS starttime 
        FROM   xydata a 
               INNER JOIN fm4features f 
                 ON f.id = a.id 
        WHERE  objectid = '17' 
               AND clientid = '1' 
               AND gstime > '2010-04-20 08:22:27' 
               AND gstime < '2010-04-26 10:22:27' 
               AND f.dataid = '1' 
               AND f.VALUE = '1') derived 
GROUP  BY Date_format(gstime, '%Y-%m-%d') 
ORDER  BY gstime ASC
anybody having idea please help me

Bakthavachalam E

Edited by: user13055307 on Apr 29, 2010 2:57 AM
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 27 2010
Added on Apr 29 2010
0 comments
1,251 views