-->
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.  [ 2 posts ] 
Author Message
 Post subject: what is the result of avg(datetime)?
PostPosted: Mon Jul 31, 2006 4:34 am 
Newbie

Joined: Mon Jun 05, 2006 9:22 am
Posts: 3
I use avg() function to calculate the average time for some selected rows, using something like:

'avg(t.datetime1 - t.datetime2)'

Since MySql is in behind, the returned result is in 'military' format, e.g. for average time of 3 min and 5 sec, the result is : 305.

I also know that other databases (Oracle) does not return the avg of datetime in the same format (its in days?)


Anyhow, I just wonder if Hibernate ...

[1] ...just pass the returned result of the query, without any further processing that might occur due to different db layer; or

[2] ...process the returned results, so the returned result will be the same for any implemented db.


Of course, answer #2 is expected from a good orm tool. So, can anyone officially confirm which answer is correct, #1 or #2?

Thank you in advance.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 31, 2006 4:57 am 
Newbie

Joined: Thu Apr 27, 2006 3:55 am
Posts: 4
Hello najgor,

the avg function return type depends on the hibernate version. Starting with hibernate 3.2 it will always be a Hibernate.DOUBLE.


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

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.