#1060 - findSingleAttributeList doesn't store result in L2 query cache

This commit is contained in:
rob bygrave
2017-07-06 21:35:20 +12:00
parent 7a697c12af
commit 95aed6af54
7 changed files with 74 additions and 30 deletions
+37
View File
@@ -47,6 +47,43 @@ public class TestQueryCache extends BaseTestCase {
assertThat(list2.get(0).getColumnB()).isEqualTo("10");
}
@Test
public void findSingleAttribute() {
new EColAB("03", "SingleAttribute").save();
new EColAB("03", "SingleAttribute").save();
List<String> colA_first = Ebean.getServer(null)
.find(EColAB.class)
.setUseQueryCache(true)
.setDistinct(true)
.select("columnA")
.where()
.eq("columnB", "SingleAttribute")
.findSingleAttributeList();
List<String> colA_Second = Ebean.getServer(null)
.find(EColAB.class)
.setUseQueryCache(true)
.setDistinct(true)
.select("columnA")
.where()
.eq("columnB", "SingleAttribute")
.findSingleAttributeList();
assertThat(colA_Second).isSameAs(colA_first);
List<String> colA_NotDistinct = Ebean.getServer(null)
.find(EColAB.class)
.setUseQueryCache(true)
.select("columnA")
.where()
.eq("columnB", "SingleAttribute")
.findSingleAttributeList();
assertThat(colA_Second).isNotSameAs(colA_NotDistinct);
}
@Test
@SuppressWarnings("unchecked")
public void test() {