[hibernate-issues] [Hibernate-JIRA] Created: (HHH-4699) String mapped ENUMs can't be loaded from CHARs only VARCHARS (fix is trivial)

Pierce Wetter (JIRA) noreply at atlassian.com
Tue Dec 15 15:17:30 EST 2009


String mapped ENUMs can't be loaded from CHARs only VARCHARS (fix is trivial)
-----------------------------------------------------------------------------

                 Key: HHH-4699
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4699
             Project: Hibernate Core
          Issue Type: Bug
          Components: core
    Affects Versions: 3.5
         Environment: all
            Reporter: Pierce Wetter


An enum persisted as a string to a CHAR column comes back with extra spaces appended, so then fails the Enum.valueOf() lookup.

Fix is easy:

Line 132 of EnumType.java, method nullSafeGet, change:

				return Enum.valueOf( enumClass, name );
to
				return Enum.valueOf( enumClass, name.trim() );

Which should be perfectly logical, because spaces are illegal in enum names anyways. 

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