title: Enum field in JPA Entity
body: <p>I feel a little dumb asking this but I can't find any simple answer to the question.</p>
  
  <p>Take this simple entity as example:</p>
  
  <pre><code>@Entity
  @Table( name="clienti" )
  public class Cliente implements Serializable {
  
      private static final long serialVersionUID = 1L;
  
      @Id
      @GeneratedValue(strategy = GenerationType.IDENTITY)
      @Column(name = "id")
      private Long id;
  
      private String nome;
  
      private String cognome;
  
  //...
  }
  </code></pre>
  
  <p>It represents a person, so I want to add a "<strong>gender</strong>" property. </p>
  
  <p>It will be "male" or "female". So what?</p>
  
  <p>I can use a String, and keep in mind that "m" stands for male and "f" for female.</p>
  
  <p>Or I can use a boolean "isMale", true or false.</p>
  
  <p>However, I don't think in either case Hibernate purists would be happy :)</p>
  
  <p>Googling a little bit I found that the best practice is using an <strong>enum</strong>.</p>
  
  <p>I am a little confused on how to use it. Can you help me with an example?</p>