Hibernate – How to set enum value in setParameter hibernate query

hibernate

How to set enum value in setParameter hibernate query.

query.setParameter( "keyValue", Enum.valueOf(, KeywordType.specific));

Best Answer

Assuming the enum is KeywordType and you want to pass the specific instance of this enum:

query.setParameter("keyValue", KeywordType.specific);

Just like you would use the enum anywhere else.