title: How can I store Enum value as a String with Hibernate to SQL Server?
body: <p>So I'm having an Enum-property in an Entity bean:</p>
  
  <pre><code>@Entity
  @Table(name = "fileAttachment")
  public class FileAttachment
  
  // other properties..
  
  @Enumerated(EnumType.STRING)
  FileAttachmentType type;
  
  // getters and setters
  </code></pre>
  
  <p>However, when I persist the bean, the value in that column is shown as a number such as 0 or 1 or 2.</p>
  
  <p>If I <code>println</code> the value of the enum just before persisting the bean with EntityManager, the value prints out as String, such as <code>INVOICE</code> but in the SQL Server table that row has value 2 for example on the fileAttachmentType-column. What else do I need to configure? I thought the <code>EnumType.STRING</code> would do the trick.</p>