hi-
I have a strange situation in my mysql database where I have a char(1) column with an empty string in some rows. The default java.lang.Character type will throw a StringIndexOutOfBoundsException for these empty strings. I logged a bug to just change the empty strings to nulls for the default CharacterType, but it was rejected on the grounds that empty strings are not really characters at all and so the CharacterType class shouldn't handle them. I was told to write a custom user type to handle it, which is fine by me.
Since the empty strings were generated by a legacy app that will be running alongside my new hibernate app, I need to use this custom type for all char(1) columns in my database, at least 60 places currently. I'd like to have hibernate map java.lang.Character to my custom type by default, instead of having to add my custom type for each character, which is error-prone.
Is there a way to do this? I looked in the source code, and the TypeFactory class seems designed to prevent this. Is there a way to do it?
Hibernate version: 2.1.7
Bug reference:
http://opensource.atlassian.com/project ... se/HB-1355