[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-5774) casting exceptions with Teradata database

Gail Badner (JIRA) noreply at atlassian.com
Mon Dec 20 20:43:05 EST 2010


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

Gail Badner commented on HHH-5774:
----------------------------------

Is this fixed by HHH-5325?

> casting exceptions with Teradata database
> -----------------------------------------
>
>                 Key: HHH-5774
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5774
>             Project: Hibernate Core
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 3.5.3
>         Environment: Hibernate 3.5.3 on Windows XP against a Teradata 13.0 Database
>            Reporter: David Repshas
>         Attachments: castingDiffs.txt
>
>
> Several test cases encounter a java.lang.ClassCastException because Teradata maps 'Double Precision' columns to 'Float':
> This code from line 223 of test.component.basic.ComponentTest:testCustomColumnReadAndWrite illustrates the problem:
> {code:borderStyle=solid}
>  Double heightViaSql = (Double)s.createSQLQuery("select height_centimeters from t_user where
> t_user.username='steve'").uniqueResult();
> {code}
> height_centimeters was declared as "DOUBLE PRECISION not null"
> and so the attempt to cast a Float to a Double causes the ClassCast Exception
> Variants of this code appear in the files that follow:
> .\project\testsuite\src\test\java\org\hibernate\test\component\basic\ComponentTest.java
> .\project\testsuite\src\test\java\org\hibernate\test\compositeelement\CompositeElementTest.java	
> .\project\testsuite\src\test\java\org\hibernate\test\hql\ASTParserLoadingTest.java
> .\project\testsuite\src\test\java\org\hibernate\test\instrument\cases\TestCustomColumnReadAndWrite.java
> .\project\testsuite\src\test\java\org\hibernate\test\join\JoinTest.java
> .\project\testsuite\src\test\java\org\hibernate\test\subselect\SubselectTest.java
> .\project\testsuite\src\test\java\org\hibernate\test\unionsubclass2\UnionSubclassTest.java
> .\project\testsuite\src\test\java\org\hibernate\test\joinedsubclass\JoinedSubclassTest.java
> This can be fixed by changing the code to use new Double(String x)
> The problem entry above then becomes:
> {code:borderStyle=solid}
>  Double heightViaSql = new Double(s.createSQLQuery("select height_centimeters from t_user
> where t_user.username='steve'").uniqueResult().toString());
> {code}
> The attached file castingDiffs contains the changes made against Hibernate 3.5.3

-- 
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