ERROR - org.hibernate.exception.SQLGrammarException: could not execute query caused by java.sql.SQLSyntaxErrorException: ORA-01722: invalid number while using Hibernate , Criteria and Enums

Error

org.hibernate.exception.SQLGrammarException: could not execute query


caused by

"java.sql.SQLSyntaxErrorException: ORA-01722: invalid number" while using Hibernate , Criteria and Enums

Error Type

Runtime
Cause

We haven't explicitly specified that the field is Enum String and hence its expecting Enum Ordinal value ( enum index ) as the mapped column type.

Resolution 

Add @Enumerated(EnumType.STRING) to the enum field within Entity.