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

Firman Drage (JIRA) noreply at atlassian.com
Tue Mar 27 04:40:48 EDT 2012


    [ https://hibernate.onjira.com/browse/HHH-4699?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=46087#comment-46087 ] 

Firman Drage commented on HHH-4699:
-----------------------------------

This problem still exits, and reproduce able, when the DB2 Database is used.

I'm using this version of hibernate.
- hibernate-core-3.6.8.Final.jar
- hibernate-jpa-2.0-api-1.0.1.Final.jar



> String mapped ENUMs can't be loaded from CHARs only VARCHARS (fix is trivial)
> -----------------------------------------------------------------------------
>
>                 Key: HHH-4699
>                 URL: https://hibernate.onjira.com/browse/HHH-4699
>             Project: Hibernate ORM
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 3.5.0-Beta-3
>         Environment: all
>            Reporter: Pierce Wetter
>            Assignee: Gail Badner
>         Attachments: hibernate-4699.zip
>
>   Original Estimate: 10m
>  Remaining Estimate: 10m
>
> 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.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list