diff --git a/integration-tests/hibernate-orm-panache/src/main/java/io/quarkus/it/panache/TestEndpoint.java b/integration-tests/hibernate-orm-panache/src/main/java/io/quarkus/it/panache/TestEndpoint.java index 336bfa6798f4c6..a694e37098f4a5 100644 --- a/integration-tests/hibernate-orm-panache/src/main/java/io/quarkus/it/panache/TestEndpoint.java +++ b/integration-tests/hibernate-orm-panache/src/main/java/io/quarkus/it/panache/TestEndpoint.java @@ -1236,6 +1236,16 @@ public String testProjection() { Assertions.assertNull(aggregationProjection.getOwnerName()); Assertions.assertEquals(bubulle.weight, aggregationProjection.getWeight()); + PanacheQuery projectionDistinctQuery = Cat + // The spaces at the beginning are intentional + .find(" SELECT disTINct c.name, cast(null as string), SUM(c.weight) from Cat c where name = :name group by name ", + Parameters.with("name", bubulle.name)) + .project(CatProjectionBean.class); + CatProjectionBean aggregationDistinctProjection = projectionDistinctQuery.singleResult(); + Assertions.assertEquals(bubulle.name, aggregationDistinctProjection.getName()); + Assertions.assertNull(aggregationDistinctProjection.getOwnerName()); + Assertions.assertEquals(bubulle.weight, aggregationDistinctProjection.getWeight()); + long count = projectionQuery.count(); Assertions.assertEquals(1L, count);