-->
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: Calculating working hours query in hibernate
PostPosted: Thu Apr 29, 2010 6:59 am 
Newbie

Joined: Wed Mar 31, 2010 4:35 am
Posts: 19
Hello,

Code:

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


How do i change this into Hibernate,
please help me anybody having idea.

Bakthavachalam E


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.