Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set enum value in setParameter hibernate query

Tags:

hibernate

How to set enum value in setParameter hibernate query.

query.setParameter( "keyValue", Enum.valueOf(, KeywordType.specific));
like image 861
shitanshu Avatar asked Feb 24 '26 00:02

shitanshu


1 Answers

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.

like image 64
JB Nizet Avatar answered Feb 26 '26 13:02

JB Nizet



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!