Column not found in Turkish locale because of toLowerCase()
Description
Because of the call to String.toLowerCase() without a locale in TableMetadata.addColumn(ResultSet), the name of a column can be incorrectly set when the default locale is Turkish.
Example:
the original column name is "id",
in addColumn(ResultSet), the name becomes ıd (note the first character is 'ı' (U+0131) instead of 'i' (U+0069) because of the String.toLowerCase() in line 154),
as a result, the construction of the SessionFactory fails with a HibernateException:
Attached is a test case for the problem:
test case:
;
build file:
.
Owing the fix to in 4.2.7, it might be possible to fix the problem by switching the direct call to String.toLowerCase() by StringHelper.toLowerCase(String); i.e. from:
If everyone wrote ticket descriptions like you, I'd be a happy camper
I corrected all uses of #toLowerCase within HBM2DDL and added a regression test. I know it's obnoxious, but I'd like to keep treating these on a case-by-case basis. Searching for all instances of that will explain why...
Because of the call to
String.toLowerCase()
without a locale inTableMetadata.addColumn(ResultSet)
, the name of a column can be incorrectly set when the default locale is Turkish.Example:
the original column name is "id",
in
addColumn(ResultSet)
, the name becomes ıd (note the first character is 'ı' (U+0131) instead of 'i' (U+0069) because of theString.toLowerCase()
in line 154),as a result, the construction of the
SessionFactory
fails with aHibernateException
:Attached is a test case for the problem:
test case:
;
build file:
.
Owing the fix to in 4.2.7, it might be possible to fix the problem by switching the direct call to
String.toLowerCase()
byStringHelper.toLowerCase(String)
; i.e. from:to: