Hello,
I have a use case in which I need to put enum constant in query result. My query looks like this:
QTable qTable = QTable.table;
SomeDTO someDTO = query.singleResult(Projections.fields(SomeDTO.class,
...,
someBooleanExpression ? qTable.enumField : <ENUM_CONSTANT>,
...));
I am looking for a way to put some constant enum value in the place of ENUM_CONSTANT.
I tried Expresssions.as, Expressions.constantAs or EnumTemplate in various combinations, but none of them worked. I think there must be a simple way to fix this, but I just don't know how.
I'm looking for something like:
(MyEnum.MyValue).as("enumField")
Any help appreciated :)