[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-4769) In HQL, function ROUND always returns an Integer, it truncate the decimal part of Double number.

Strong Liu (JIRA) noreply at atlassian.com
Fri Jan 8 11:52:29 EST 2010


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-4769?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=35153#action_35153 ] 

Strong Liu commented on HHH-4769:
---------------------------------

yeah, i'd think this is a bug, as [mysql document|http://dev.mysql.com/doc/refman/5.1/en/mathematical-functions.html#function_round] said :

"The return type is the same type as that of the first argument (assuming that it is integer, double, or decimal). This means that for an integer argument, the result is an integer (no decimal places): "



> In HQL, function ROUND always returns an Integer, it truncate the decimal part of Double number.
> ------------------------------------------------------------------------------------------------
>
>                 Key: HHH-4769
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4769
>             Project: Hibernate Core
>          Issue Type: Bug
>          Components: core, entity-manager, query-hql
>    Affects Versions: 3.3.2
>         Environment: hibernate 3.3.2, mysql-connector-java-5.1.7, database MYSQL 5. 
>            Reporter: Andrea Tunesi
>            Assignee: Strong Liu
>            Priority: Blocker
>
> Running the query "select round(stTmpRiepCap.imponibile,1), round(stTmpRiepCap.ritImponibile,1) from StTmpRiepCap stTmpRiepCap", it always returns an Integer and it always truncate the decimal part of Double number ("stTmpRiepCap.imponibile" and "stTmpRiepCap.ritImponibile" are "java.lang.Double").
> Example
> REAL VALUE - Imponibile: 1528.57 -- Ritenuta imponibile 266.13
> VALUE RETURNED USING ROUND - Imponibile: 1528 -- Ritenuta imponibile 266

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list