Fixed
Details
Assignee
UnassignedUnassignedReporter
Adrian ŁukawskiAdrian ŁukawskiLabels
Components
Affects versions
Priority
Major
Details
Details
Assignee
Unassigned
UnassignedReporter
Adrian Łukawski
Adrian ŁukawskiLabels
Components
Affects versions
Priority
Created January 20, 2018 at 2:24 PM
Updated February 27, 2018 at 7:59 AM
Resolved February 21, 2018 at 9:47 AM
When selectCase is passed to 'select' and 'groupBy' method simultaneously there is an error during criteria query compilation.
It was tested with PostgreSQL95Dialect, MySQL57Dialect and H2Dialect.
Only PostgreSQL95Dialect is affected.
SQL generated for prepare statements mechanism cannot be validated by postgres engine.
Directly from postgres console:
Error response:
Error occurs due different methods of literal handling in 'select' and 'group by' query section.
Literals from 'select' case section are handled by:
but literals from 'group by' case section are handled by:
Postgres intreprets that if in the same case section in 'select' and 'group by' are different values (e.g. 'child' and $1) it is not valid query (it needs two same values or literals there e.g. $1 and $1 or 'child' and 'child').
There is a workaround if org.hibernate.query.criteria.LiteralHandlingMode#INLINE is set then generated query is valid.
but
I also tried to use named parameters in selectCase but there I get other error.