I have a Enum with three values. It's being used as a property in an Entity bean.
Here's the property in the bean:
@Enumerated(EnumType.ORDINAL)
private BillingMethod billingMethod;
Here's the enum class:
public enum BillingMethod {
ONLINEBILL("enum.billingmethod.onlinebill"), // Should be 1, but is now 0 in the database
PAPERBILL("enum.billingmethod.paperbill"), // Should be 2, but is now 1 in the database
PRINT("enum.billingmethod.print"); // Should be 3, but is now 2 in the database
private String tag;
private BillingMethod(String tag){
this.tag = tag;
}
@Override
public String getTag() {
return tag;
}
}
There is a very rare, specific reason why I need those values to be 1, 2, 3. Instead of the usual 0, 1, 2 in the database.
Don't worry about the tag
here, it is used to get the String presentation from a property file.
So, how can I set the ORDINAL to begin from 1 instead of 0?