title: How should I store an Java Enum in JavaDB?
body: <p>How should I store an Java Enum in JavaDB?</p>
  
  <p>Should I try to map the enums to <code>SMALLINT</code> and keep the values in source code only? The embedded database is only used by a single application. Or should I just store the values as <code>DECIMAL</code>? None of these solutions feels good/robust for me. Is there any better alternatives?</p>
  
  <p>Here is my enum:</p>
  
  <pre><code>import java.math.BigDecimal;
  
  public enum Vat {
      NORMAL(new BigDecimal("0.25")),
      FOOD(new BigDecimal("0.12")),
      BOOKS(new BigDecimal("0.06")),
      NONE(new BigDecimal("0.00"));
  
      private final BigDecimal value;
  
      Vat(BigDecimal val) {
          value = val;
      }
  
      public BigDecimal getValue() {
          return value;
      }
  }
  </code></pre>
  
  <p>I have read other similar questions on this topic, but the problem or solution doesn't match my problem. <a href="https://stackoverflow.com/questions/1015058/enum-storage-in-database-field">Enum storage in Database field</a>, <a href="https://stackoverflow.com/questions/2646498/best-method-to-store-enum-in-database">Best method to store Enum in Database</a>, <a href="https://stackoverflow.com/questions/1612319/best-way-to-store-enum-values-in-database-string-or-int">Best way to store enum values in database - String or Int</a></p>