[hibernate-issues] [Hibernate-JIRA] Created: (HHH-4025) MySQLDialect should use 'character_length' Standard function for registry 'length' hql function

Michael Astreiko (JIRA) noreply at atlassian.com
Tue Jul 7 05:42:12 EDT 2009


MySQLDialect should use 'character_length' Standard function for registry 'length' hql function
-----------------------------------------------------------------------------------------------

                 Key: HHH-4025
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4025
             Project: Hibernate Core
          Issue Type: Bug
          Components: core
    Affects Versions: 3.3.2
            Reporter: Michael Astreiko
            Priority: Critical
         Attachments: mysqlDialect.patch

Currently MySQLDialect register 'length' hql function as 'length' Standard MySQL function. But MySql standard function 'length' ([http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_length]) returns the length of the string, measured in bytes instead of length of the string, measured in characters. So there is a problem when MySql database use UTF-8 encoding and for some characters (such as German umlauts) used 2 bytes.

So MySQLDialect should register 'length' hql function as 'char_length' Standard MySQL function ([http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_char-length]) which returns the length of the string, measured in characters.

Appropriate patch is attached.

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