mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
#1331 - ENH: Support Aggregation formula with findSingleAttribute() ... max, min, avg, count and count(distinct ..)
This commit is contained in:
@@ -99,6 +99,21 @@ public class TestQuerySingleAttribute extends BaseTestCase {
|
||||
assertThat(name).isNotNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void findSingleAttribute_with_aggregate() {
|
||||
|
||||
ResetBasicData.reset();
|
||||
|
||||
Query<Customer> query = Ebean.find(Customer.class)
|
||||
.select("max(name)")
|
||||
.where().gt("id", 1).query();
|
||||
|
||||
String name = query.findSingleAttribute();
|
||||
|
||||
assertThat(sqlOf(query)).contains("select max(t0.name) from o_customer t0");
|
||||
assertThat(name).isNotNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void findSingleAttribute_viaExpression() {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user