title: Custom sort order for an enum field
body: <p>Is it possible to change alphabetical sorting in JPA to self defined?</p>
  
  <p>I have this data in column <code>division</code>:</p>
  
  <pre><code>BRONZE
  SILVER
  GOLD
  DIAMOND
  </code></pre>
  
  <p>And I have mapped this to an entity field:    </p>
  
  <pre><code>public enum Division {
      BRONZE,
      SILVER,
      GOLD,
      DIAMOND
  }
  
  @Entity
  public class MyEntity {
  
    @Enumerated(EnumType.STRING)
    private Division division;
  
    ...
  }
  </code></pre>
  
  <p>If I use default sorting I get an alphabetical order:</p>
  
  <ul>
  <li><strong>B</strong>RONZE</li>
  <li><strong>D</strong>IAMOND</li>
  <li><strong>G</strong>OLD</li>
  <li><strong>S</strong>ILVER</li>
  </ul>
  
  <p>But I want to have sorting by quality of ore (in the order of the enum).</p>