org.hibernate.type.UUIDCharType incorrectly mapped to char and causes test fail due to the padding space

Description

SQL-92 standard 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:

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.

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

Attachments

1
  • 17 Aug 2010, 01:19 PM

Activity

Show:

Steve Ebersole March 21, 2011 at 7:09 PM

Bulk closing stale resolved issues

Strong Liu September 1, 2010 at 8:58 PM

patch applied, thanks Ray

Ray Fan August 17, 2010 at 1:19 PM

Patch modifies the type mapping from CharType to VarcharType to avoid the inclusion of trailing spaces.

Fixed

Details

Assignee

Reporter

Components

Fix versions

Priority

Created August 17, 2010 at 1:17 PM
Updated March 21, 2011 at 7:09 PM
Resolved September 1, 2010 at 8:58 PM

Flag notifications