title: Hibernate Enum mapping using annotaions
body: <p>I have an existing database that I am now connecting to using hibernate.  I cannot change the data in it at the moment and have everything working apart from a single column.</p>
  
  <p>I have a status column that has the values:</p>
  
  <ul>
  <li>new</li>
  <li>mailed</li>
  <li>in</li>
  <li>out</li>
  </ul>
  
  <p>And the column is mapped as follows:</p>
  
  <pre><code>@Column(name = "STATUS", nullable = false, length = 50)
  @Enumerated(EnumType.STRING)
  private TeamMemberStatus status;
  </code></pre>
  
  <p>I would REALLY like (for application reasons) to have this column mapped as a Java Enum (TeamMemberStatus), <strong>but due to the fact that 'new' is a keyword in Java</strong> I cannot have that as an enum member.</p>
  
  <p>If I have the enum contstants NEW, MAILED, IN and OUT hibernate fails as inside EnumType it does a Enum.valueOf().</p>
  
  <p>Is there any way for me to map this to my Enum without having to write a complex UserType?</p>
  
  <p>-- added content</p>
  
  <p>My Enum like this:</p>
  
  <pre><code>public enum TeamMemberStatus {
      NEW, MAILED, IN, OUT 
  }
  </code></pre>
  
  <p>is a valid Java enum, but not matching the case of the database.  If I change it to match the database like:</p>
  
  <pre><code>public enum TeamMemberStatus {
      new, mailed, in, out
  }
  </code></pre>
  
  <p>It won't compile as 'new' is a Java reserved word.</p>