HHH-4699 trim value from database before Enum.valueOf()

this change fixes the problem with fixed size columns with enum values
that are right padded.
This commit is contained in:
Kristian Marinkovic 2013-05-15 21:23:32 +02:00 committed by Brett Meyer
parent 0b488b92a0
commit ad5dd18aac
1 changed files with 4 additions and 1 deletions

View File

@ -455,7 +455,10 @@ public class EnumType implements EnhancedUserType, DynamicParameterizedType,Logg
private Enum fromName(String name) { private Enum fromName(String name) {
try { try {
return Enum.valueOf( enumClass, name ); if(name == null) {
return null;
}
return Enum.valueOf( enumClass, name.trim() );
} }
catch ( IllegalArgumentException iae ) { catch ( IllegalArgumentException iae ) {
throw new IllegalArgumentException( throw new IllegalArgumentException(