title: Hibernate enum throw Unknown name value [true] for enum class
body: <p>I am using MySQL and I have a columns data type as <strong>Enum</strong>, I have define an enum type in my Entity However when query executes to retrive data it throws following exception:</p>
  
  <pre><code>Caused by: java.lang.IllegalArgumentException: Unknown name value [true] for enum class [com.myproject.MyEnum]
      at org.hibernate.type.EnumType$NamedEnumValueMapper.fromName(EnumType.java:467)
      at org.hibernate.type.EnumType$NamedEnumValueMapper.getValue(EnumType.java:452)
      at org.hibernate.type.EnumType.nullSafeGet(EnumType.java:107)
  </code></pre>
  
  <p>Following is my Entity and Enum source</p>
  
  <pre><code>public enum MyEnum {
      TRUE("true"),
      FALSE("false");
  
      private final String name;
  
      private MyEnum (String name){
          this.name = name;
      } 
  
      public String toString(){
          return name;
      }
  }
  </code></pre>
  
  <p>In my table structure I have define enum{true,false}</p>
  
  <pre><code>@Entity
  @Table(name="networthcashother")
  public class Networthcashother {
      @Id
      @Column(name="id")
      @GeneratedValue(strategy=GenerationType.IDENTITY)
      private int id;
      private String assetName;
      private String assetDescription;
  
      @Enumerated(EnumType.STRING)
      private MyEnum  married; 
  
      public MuEnum getMarried() {
          return married;
      }
  
      public void setMarried(MyEnum married) {
          this.married = married;
      }
  }
  </code></pre>
  
  <p>However If I change my entity property type from Enum to boolean it works fine. Whats m doing wrong.</p>