Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 947946 - Incorrect "to_char" function in HSQL dialect
Incorrect "to_char" function in HSQL dialect
Status: CLOSED CURRENTRELEASE
Product: JBoss Enterprise Application Platform 6
Classification: JBoss
Component: Hibernate (Show other bugs)
6.1.0
Unspecified Unspecified
unspecified Severity unspecified
: ER1
: EAP 6.2.0
Assigned To: Brett Meyer
:
Depends On:
Blocks: eap62-upgrade-hibernate425
  Show dependency treegraph
 
Reported: 2013-04-03 11:17 EDT by Adam Kovari
Modified: 2015-09-01 00:00 EDT (History)
5 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
A bug in the HSQL dialect implementation of the `to_char` function resulted in incorrect conversions of objects to strings, and when used in a comparison would result in a `java.lang.IllegalArgumentException` exception. In this release of JBoss EAP 6, the `to_char` function in the HSQL dialect has been fixed by properly converting objects to a string. As a result, comparisons made using the `to_char` should no longer throw `java.lang.IllegalArgumentException` exceptions.
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-12-15 11:17:28 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Adam Kovari 2013-04-03 11:17:24 EDT
Description of problem:


    I believe(have tried) we have incorrectly registered TO_CHAR in HSQL dialect:

    org.hibernate.dialect.HSQLDialect:
    registerFunction( "to_char", new StandardSQLFunction( "to_char" ) );

    while org.hibernate.dialect.Oracle8iDialect:
    registerFunction( "to_char", new StandardSQLFunction("to_char",StandardBasicTypes.STRING) );

    We're comparing a TO_CHAR construct that gets a Calendar as parameter to a String. The TO_CHAR converts the Calendar to a String, making it possible to compare it with a String. For me it looks like Hibernate
    doesn't get that TO_CHAR makes that conversion and only sees that there's a Calendar (within the TO_CHAR) on the left hand side and a String parameter on the right hand side and decides (erroneously I think) that a comparison between the two is invalid.


Version-Release number of selected component (if applicable):
- tested in EAP 6.0.1 and 6.1.0 Alpha

How reproducible:
- always

Steps to Reproduce:
Reproducer is attached to the customer's case.

  
Actual results:
Exception thrown.

Expected results:
Query parsed properly.


Additional info:
upstream Jira with proposed patch: https://hibernate.atlassian.net/browse/HHH-8136
Comment 1 Brett Meyer 2013-04-03 11:31:28 EDT
HHH-8136 pushed to eap61-cp branch
Comment 2 Brett Meyer 2013-04-25 17:03:38 EDT
The above is a typo.  Pushed to eap61-cp-updates and will be merged into Hibernate's future EAP 6.2 branch.
Comment 4 Zbyněk Roubalík 2013-09-23 07:29:47 EDT
EAP 6.2.0.ER1

Note You need to log in before you can comment on or make changes to this bug.