Skip to content

Commit

Permalink
[#26284] Test select-distinct with .project
Browse files Browse the repository at this point in the history
  • Loading branch information
DavideD committed Jul 9, 2022
1 parent 974235f commit e99d9c2
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1236,6 +1236,16 @@ public String testProjection() {
Assertions.assertNull(aggregationProjection.getOwnerName());
Assertions.assertEquals(bubulle.weight, aggregationProjection.getWeight());

PanacheQuery<CatProjectionBean> 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);

Expand Down

0 comments on commit e99d9c2

Please sign in to comment.