Issues

Select view

Select search mode

 
18 of 18

JPQL cast and Criteria API Expression.as produce wrong SQL for Float and Double types with mySQL database

Out of Date

Description

When creating Criteria API expression using Expression.as(Double.class) or Expression.as(Float.class) wrong SQL is produced. First one produces "cast(<attribute> as double precision)" and the second one "cast(<attribute> as float)". Either of these syntax are not working with MySQL database.

Noticed that same bug applies also to JPQL queries, so it is not Criteria API specific. For example "select cast(t.<attribute> as double) from Table t".

Details

Assignee

Reporter

Labels

Components

Affects versions

Priority

Created October 27, 2016 at 7:51 AM
Updated April 8, 2022 at 12:25 PM
Resolved April 8, 2022 at 12:25 PM

Activity

Show:

Christian Beikov April 8, 2022 at 12:25 PM

Since no test case was provided for years, I'll close this issue as out of date. I also believe it will most probably not be an issue any more in 6.0.
If this still is an issue for you, please create a new issue with a test case that reproduces the problem.

Former user October 31, 2016 at 9:17 PM

, this is probably fixed by https://hibernate.atlassian.net/browse/HHH-9969#icft=HHH-9969 in 5.0. Please confirm.

Former user October 29, 2016 at 12:23 AM

, 4.2 is no longer maintained. Please attach a unit test using 5.2 that reproduces your issue. You can find a test template at: https://github.com/hibernate/hibernate-test-case-templates.