[hibernate-issues] [Hibernate-JIRA] Created: (HHH-6655) trim function on DB2 is broken

Strong Liu (JIRA) noreply at atlassian.com
Wed Sep 14 13:13:03 EDT 2011


trim function on DB2 is broken
------------------------------

                 Key: HHH-6655
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6655
             Project: Hibernate Core
          Issue Type: Bug
    Affects Versions: 4.0.0.CR2
            Reporter: Strong Liu


For DB2 a warning message is generated by TempateRenderer which is not seen for other databases:
WARN: HHH00174:Function template anticipated 3 arguments, but 2 arguments encountered

see test _org.hibernate.ejb.criteria.CriteriaCompilingTest#testTrim_ for more details
Also the query created is different in case of DB2:
Hibernate: select replace(replace(ltrim(rtrim(replace(replace(customer0_.NAME,' ','${space}$'),?,' '))),' ',?),'${space}$',' ') as col_0_0_ from CUSTOMER_TABLE customer0_ where customer0_.NAME=? fetch first 2 rows only

and finally it fails because of above warning:

javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: DB2 SQL Error: SQLCODE=-313, SQLSTATE=07001

For other DBs same code generates following query and test passes:

Hibernate: select trim(BOTH ? from customer0_.NAME) as col_0_0_ from CUSTOMER_TABLE customer0_ where customer0_.NAME=? limit ?

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list