mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
NPE Fix with .setCountDistinct(CountDistinctOrder.NO_ORDERING)
This commit is contained in:
@@ -736,6 +736,8 @@ final class CQueryBuilder {
|
||||
return " order by count(*) desc, r1.attribute_";
|
||||
case COUNT_DESC_ATTR_DESC:
|
||||
return " order by count(*) desc, r1.attribute_ desc";
|
||||
case NO_ORDERING:
|
||||
return "";
|
||||
default:
|
||||
throw new IllegalArgumentException("Illegal enum: " + orderBy);
|
||||
}
|
||||
|
||||
@@ -646,6 +646,14 @@ public class TestQuerySingleAttribute extends BaseTestCase {
|
||||
.findSingleAttributeList();
|
||||
assertThat(list1.get(0)).isInstanceOf(CountedValue.class);
|
||||
//assertThat(list1.toString()).isEqualTo("[1: Tracy, 3: Jim1, 1: Jack, 3: Fred1, 1: Fiona, 3: Bugs1]");
|
||||
|
||||
query = DB.find(Contact.class).select("firstName");
|
||||
list1 = query
|
||||
.setCountDistinct(CountDistinctOrder.NO_ORDERING)
|
||||
.findSingleAttributeList();
|
||||
assertThat(list1.get(0)).isInstanceOf(CountedValue.class);
|
||||
assertThat(sqlOf(query)).contains("select r1.attribute_, count(*) from ("
|
||||
+ "select t0.first_name as attribute_ from contact t0");
|
||||
|
||||
query = DB.find(Contact.class).select("firstName");
|
||||
list1 = query
|
||||
|
||||
Reference in New Issue
Block a user