Closed TuomasKiviaho closed 9 years ago
Does this happen with Querydsl SQL or JPA native queries or both?
I've only tested this against QueryDSL SQL via SimpleExpression
The same error seems to be present in Querydsl 3. Which version did you use?
QueryDSL 3.6.7. The project I encountered this with has been dormant for quite some while so this is not something that has been introduced recently. I see that with 3.6.3 it was still working.
UPDATE: Just to be absolutely sure I run our integration test against 3.6.3 without the workaround and it worked.
I've used to do aliasing by reusing the original path
SFoo.bar.nullif(0).as(SFoo.bar)
. This nowadays leads toNULLIF("foo"."bar", 0 ) AS "foo"."bar"
but it used to beNULLIF("foo"."bar", 0 ) AS "bar"
.The new form doesn't work with neither H2 or MySQL and I guess that other databases do not appreciate it either.
As a workaround I used
SFoo.bar.nullif(0).as(SFoo.bar.getMetadata().getName())
which turns the path into a variable and hence works as expected.I guess this has been done to support aliasing in some other parts of the query (
JOIN
maybe), but it doesn't work asSELECT
anymore. I see thatSQLSerializer
has gimmicks involvingOps.ALIAS
so could it be possible to intervene there how the result is actually printed out