#1572 - Support query.select("customer.id").findSingleAttributeList() ... in addition to the expected and working select("customer").findSingleAttributeList()

This commit is contained in:
rob bygrave
2018-12-06 00:15:06 +13:00
parent e4088c5fbe
commit bafba0babf
2 changed files with 18 additions and 7 deletions
@@ -359,6 +359,21 @@ public class TestQuerySingleAttribute extends BaseTestCase {
assertThat(sqlOf(query)).contains("select distinct t0.customer_id from contact t0 order by t0.customer_id desc");
}
@Test
public void distinctWithOrderByPkWithId() {
ResetBasicData.reset();
Query<Contact> query = Ebean.find(Contact.class)
.setDistinct(true)
.select("customer.id")
.orderBy().desc("customer.id");
query.findSingleAttributeList();
assertThat(sqlOf(query)).contains("select distinct t0.customer_id from contact t0 order by t0.customer_id desc");
}
@Test
public void distinctWithCascadedFetchOrderByPk() {