#565 - Query plan hash collision on firstRow/maxRows combinations - tests

This commit is contained in:
Robin Bygrave
2016-02-13 12:30:00 +13:00
parent 8a8b36ec1e
commit ae38672e02
2 changed files with 63 additions and 0 deletions
@@ -37,4 +37,28 @@ public class DefaultOrmQueryTest {
assertThat(hash1).isNotEqualTo(hash2);
}
@Test
public void test_AutofetchHash_diffFirstRows() throws Exception {
SpiQuery<?> query1 = (SpiQuery<?>)Ebean.find(Order.class)
.setFirstRow(0)
.setMaxRows(31);
HashQueryPlanBuilder b1 = new HashQueryPlanBuilder();
query1.queryAutoTuneHash(b1);
HashQueryPlan hash1 = b1.build();
SpiQuery<?> query2 = (SpiQuery<?>)Ebean.find(Order.class)
.setFirstRow(1)
.setMaxRows(0);
HashQueryPlanBuilder b2 = new HashQueryPlanBuilder();
query2.queryAutoTuneHash(b2);
HashQueryPlan hash2 = b2.build();
assertThat(hash1).isNotEqualTo(hash2);
}
}