I have a table with a `status: varchar` column. Java entity class has property:
Code:
public enum Status { ENABLED, DISABLED }
private Status status;
@Enumerated(EnumType.STRING)
public Status getStatus() {
return status;
}
That fails. But it works if I move the `@Enumerated` annotation to the private field, instead of the getter. Is that expected behavior?
The error when the annotation is on the getter:
org.postgresql.util.PSQLException: Bad value for type int : ENABLEDI stepped through code and can see it's treating the enum property as if it didn't have the `@Enumerated` and it's defaulting to `EnumType.ORDINAL`.
I thought it was acceptable, or even preferred, to put the annotations on the getters, not the fields.
Rob