mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
#2196 - SQLException:Column "T0.ID" must be in the GROUP BY list - when findCount with having clause
This commit is contained in:
@@ -3,6 +3,7 @@ package org.tests.query.aggregation;
|
||||
import io.ebean.BaseTestCase;
|
||||
import io.ebean.Ebean;
|
||||
import io.ebean.Query;
|
||||
import io.ebeantest.LoggedSql;
|
||||
import org.ebeantest.LoggedSqlCollector;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
@@ -91,6 +92,22 @@ public class TestAggregationCount extends BaseTestCase {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void findCount_withHaving() {
|
||||
Query<TEventOne> query = Ebean.find(TEventOne.class)
|
||||
//.select("id, totalUnits")
|
||||
.having()
|
||||
.ge("totalUnits", 1)
|
||||
.query();
|
||||
|
||||
LoggedSql.start();
|
||||
int count = query.findCount();
|
||||
List<String> sql = LoggedSql.stop();
|
||||
assertThat(sql).hasSize(1);
|
||||
assertThat(sql.get(0)).contains("group by t0.id");
|
||||
assertThat(count).isGreaterThan(0);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFull() {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user