AgentMime
JCHJava Community | Help. Code. Learn.
•Created by AgentMime on 9/18/2024 in #java-help
Java Hibernate with Negative Enums
I'm using Hibernate for JPA for persisting objects to my database. One class has four possible statuses that I want to represent with an enum, and I want to use a negative status for DELETED for consistency with previous classes:
However, Hibernate doesn't like this and is throwing an exception:
Is there a simple way to tell Hibernate to allow the negative Enum value? Or do I have to use non-negative values?
13 replies