[hibernate-issues] [Hibernate-JIRA] Resolved: (HHH-5484) org.hibernate.type.UUIDCharType incorrectly mapped to char and causes test fail due to the padding space

Strong Liu (JIRA) noreply at atlassian.com
Wed Sep 1 15:00:18 EDT 2010


     [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-5484?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Strong Liu resolved HHH-5484.
-----------------------------

      Assignee: Strong Liu
    Resolution: Fixed

patch applied, thanks Ray

> org.hibernate.type.UUIDCharType incorrectly mapped to char and causes test fail due to the padding space
> --------------------------------------------------------------------------------------------------------
>
>                 Key: HHH-5484
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5484
>             Project: Hibernate Core
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 3.6.0.Beta2, 3.6.0.Beta3, 3.6.0.Beta4
>            Reporter: Ray Fan
>            Assignee: Strong Liu
>             Fix For: 3.6.0.CR1
>
>         Attachments: UUIDCharType.java.svn.diff
>
>
> [SQL-92 standard|http://www.contrib.andrew.cmu.edu/~shadow/sql/sql1992.txt] indicates that right-padded spaces are part of the char, for example in the definition of the CAST function on p. 148. When source (SV=source value) and target (TV=target value, LTD=length of target datatype), then:
> {quote}
> ii)  If the length in characters of SV is larger than LTD, then
>      TV is the first LTD characters of SV. If any of the re-
>      maining characters of SV are non-<space> characters, then a
>      completion condition is raised: warning-string data, right
>      truncation.
> iii) If the length in characters M of SV is smaller than LTD,
>      then TV is SV extended on the right by LTD-M <space>s.
> {quote}
> in most dialect, jdbc char type is mapped to char(1) or the default one which means char(255), so, in these cases, UUIDCharType will not work due the the space padded character value causing an exception in UUID.fromstring() called from UUID_parse on the returned value.
> org.hibernate.test.id.uuid.sqlrep.sqlchar.UUIDCharTest can be used to reproduce this issue on other DBs except H2 and MySQL, it is a [MySQL Gotchas|http://sql-info.de/mysql/gotchas.html#1_6]

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