Uploaded image for project: 'Hibernate ORM'
  1. HHH-4699

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

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.5.0-Beta-3
    • Fix Version/s: 4.3.0.Beta4, 4.2.5
    • Component/s: hibernate-core
    • Labels:
      None
    • Environment:
      all
    • Bug Testcase Reminder (view):

      Bug reports should generally be accompanied by a test case!

    • Last commented by a user?:
      true
    • Sprint:

      Description

      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.

        Attachments

          Issue links

            Activity

              People

              • Votes:
                3 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - 10m
                  10m
                  Remaining:
                  Remaining Estimate - 10m
                  10m
                  Logged:
                  Time Spent - Not Specified
                  Not Specified