[hibernate-dev] Should LiteralExpression support Enum?

Guillaume Smet guillaume.smet at gmail.com
Mon Oct 8 08:28:28 EDT 2018


Hi,

We had an interesting test case posted this week-end, namely
https://github.com/hibernate/hibernate-orm/pull/2562/files .

Apparently, enums as result of case expressions were (sort of) supported in
5.1, whereas they are not anymore in 5.3: you end up with a NPE.

The issue is that we don't have a ValueHandler for enums and thus the
handler in
https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/main/java/org/hibernate/query/criteria/internal/expression/LiteralExpression.java#L88
is null.

Not sure if it's something we should support tbh. I mean you can use the
name of the enum instead and I think it would be good enough.

But even if we decide to not support it, I think we should probably provide
a better error than a NPE.

Thoughts?

-- 
Guillaume


More information about the hibernate-dev mailing list