[hibernate-dev] Should LiteralExpression support Enum?

Gail Badner gbadner at redhat.com
Mon Oct 8 14:57:24 EDT 2018


HHH-13016 looks like a duplicate of HHH-12184. Both mention that this
worked in 5.1.10.

The spec is clear that, for queries, this is supported. The overview for
Criteria API states, "The semantics of criteria queries are designed to
reflect those of Java Persistence query language queries."

 IMO, this should be supported for Critera queries as well.



On Mon, Oct 8, 2018 at 5:30 AM Guillaume Smet <guillaume.smet at gmail.com>
wrote:

> 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
> _______________________________________________
> hibernate-dev mailing list
> hibernate-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/hibernate-dev
>


More information about the hibernate-dev mailing list