title: Hibernate/JPA bug - Not recognizing some strings in a enum
body: <p>I have an enum in a class, mapped by Hibernate. One of the mapped fields is and enum type which has one of the following values <strong>OK</strong>, <strong>NOK</strong> or <strong>NAP</strong>. <strong>NOK</strong> or <strong>NAP</strong> works as expected, but when the field the class is set to 'OK', Hibernate fails to map and retrieve the value, which is set to null:</p>
  
  <pre><code>java.lang.IllegalArgumentException: Unknown name value for enum class     com.a.b.c.d.Class$Status: OK
      at org.hibernate.type.EnumType.nullSafeGet(EnumType.java:113)
  </code></pre>
  
  <p>The class has:</p>
  
  <pre><code>private Status status;
  
  @JoinColumn(name = "STATUS")
  @Enumerated(EnumType.STRING)
  public Status getStatus() {
      return status;
  }
  
  public enum Status {
      OK, NOK, NAP;
  }
  </code></pre>
  
  <p>If I change <strong>OK</strong> to <strong>OK2</strong>, it works correctly. <strong>_OK</strong> also works.
  As far as i'm concerned 'OK' is not a reserved name (like in this case where the guy <a href="https://stackoverflow.com/questions/3396564/hibernate-enum-mapping-using-annotaions">uses <strong>new</strong></a>) as it compiles correctly. </p>
  
  <p>Thanks!</p>
  
  <p><strong>UPDATE:</strong></p>
  
  <p>Up 'till now, what I did to solve the problem is to modify the enum and store '<strong>_OK</strong>' in the database instead of '<strong>OK</strong>', as shown above. Not very nice solution, but it works at least.</p>
  
  <pre><code>public enum Status {
      _OK("OK"), 
      NOK("NOK"), 
      NAP("NAP");
  
      private String desc;
  
      private Status(String desc){
          this.desc = desc;
      }
  
      public String getDesc(){
          return desc;
      }
  }
  </code></pre>
  
  <p><strong>BUG REPORT:</strong></p>
  
  <p>A <a href="http://opensource.atlassian.com/projects/hibernate/browse/HHH-6351" rel="nofollow noreferrer">bug report has been filled</a>. </p>