You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When the code reaches fetchCount(), an error message will be received:
Caused by: java.sql.SQLSyntaxErrorException: Table 'my_db.UnitIdMaxSeqCTE' doesn't exist
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:120)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97)
at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122)
at com.mysql.cj.jdbc.ClientPreparedStatement.executeInternal(ClientPreparedStatement.java:953)
at com.mysql.cj.jdbc.ClientPreparedStatement.executeQuery(ClientPreparedStatement.java:1003)
at com.zaxxer.hikari.pool.ProxyPreparedStatement.executeQuery(ProxyPreparedStatement.java:52)
at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.executeQuery(HikariProxyPreparedStatement.java)
at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.extract(ResultSetReturnImpl.java:57)
... 127 common frames omitted
Here's the generated native SQL:
select count(*) as col_0_0_
from units unit0_
left outer join (
select *
from UnitIdMaxSeqCTE
) unitidmaxs1_ on ((null is null) and 999 = 999 and (unitidmaxs1_.unitId is null) and unitidmaxs1_.unitId = unit0_.id)
Another strange thing is that if you replace leftJoin in the syntax with innerJoin, it works fine.
Environment
Version: 1.6.9
JPA-Provider: Hibernate 5.4.27.Final
DBMS: MySQL 8
Application Server: Java SE
QueryDSL: 4.1.4
Additional Info
In order to simplify the reproduction steps for the error, the query syntax above has been simplified. The entire query may seem a bit confusing, for example, it uses complex Projection, CTE, and sorting, but in the end, only to fetchCount 😂
This is done because many people who use the QueryDSL + Spring Data JPA framework may use the frameworks’s applyPagination method for data pagination. Therefore, the complete usage scenario is actually like this:
@beikov this appears to be an issue with the multiplicity determination for CTE's during group by elimination for count queries in core, and not the Querydsl integration.
Description
Expected behavior
It should returns the row count of the query.
Actual behavior
When the code reaches fetchCount(), an error message will be received:
Here's the generated native SQL:
Another strange thing is that if you replace leftJoin in the syntax with innerJoin, it works fine.
Environment
Version: 1.6.9
JPA-Provider: Hibernate 5.4.27.Final
DBMS: MySQL 8
Application Server: Java SE
QueryDSL: 4.1.4
Additional Info
In order to simplify the reproduction steps for the error, the query syntax above has been simplified. The entire query may seem a bit confusing, for example, it uses complex Projection, CTE, and sorting, but in the end, only to fetchCount 😂
This is done because many people who use the QueryDSL + Spring Data JPA framework may use the frameworks’s
applyPagination
method for data pagination. Therefore, the complete usage scenario is actually like this:The text was updated successfully, but these errors were encountered: