How to store Java enumeration in JavaDB?
Should I try to match the enumerations with SMALLINT and save the values โโonly in the source code? The embedded database is used by only one application. Or just save the values โโas DECIMAL ? None of these solutions seem good / reliable to me. Are there any better alternatives?
Here is my listing:
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; } }
I read other similar questions on this topic, but the problem or solution does not match my problem. Enum storage in Database field , The best way to store Enum in a database , The best way to store enum values โโin a database is String or Int
java enums database orm javadb
Jonas
source share