Hi experts,
I have a sql which count distinct two columns, and it runs well on workbench select count(distinct this_.orderId, this_.orderIdSource) as y0_, this_.errorLevel as y1_, from ShipmentOrders this_ group by this_.errorLevel
When using hibernate executing "Prepared p = parse(sql)"(org.h2.command.Parser), it throws exception when Caused by: org.h2.jdbc.JdbcSQLException: Syntax error in SQL statement "SELECT COUNT(DISTINCT THIS_.ORDERID,[*] THIS_.ORDERIDSOURCE) AS Y0_, THIS_.ERRORLEVEL AS Y1_ FROM SHIPMENTORDERS THIS_ GROUP BY THIS_.ERRORLEVEL"; expected "., [, ::, *, /, %, +, -, ||, ~, !~, NOT, LIKE, REGEXP, IS, IN, BETWEEN, AND, OR, )";
I have no idea about the "[*]" between orderId & orderIdSource. And my Java code is projectionsList.add(Projections.countDistinct("ShipmentOrderId").as("quantity")); which ShipmentOrderId has orderId & orderIdSource.
Thanks in advance for any hint/clue!
|