I am getting started with Hibernate, and I am getting the following error for an entity which is supposed to have an enum type. java.lang.IllegalArgumentException: No enum const class app.entity.ObjType. java.lang.Enum.valueOf(Enum.java:214) org.hibernate.type.EnumType.nullSafeGet(EnumType.java:125) org.hibernate.type.CustomType.nullSafeGet(CustomType.java:109) org.hibernate.type.AbstractType.hydrate(AbstractType.java:104) org.hibernate.persister.entity.AbstractEntityPersister.hydrate(AbstractEntityPersister.java:2283)
I have the following enum type defined: @Enumerated(EnumType.STRING) private ObjType type;
And the defined Enum class is as follows:
package app.entity;
public enum ObjType { typeA, typeB }
What am I doing wrong? Also do set and get methods also have to be annotated with "@Enumerated(EnumType.STRING)" ?
I would appreciate any help. Thanks
|