#1795 - Refactor bind padding for Id IN expressions (based on internal multiValueSupport and simple id)

This commit is contained in:
rob bygrave committed 2019-08-18 16:33:36 +12:00
1 parent d7d8c3e651
commit 9155716752
14 files changed
+214 -113

No files matched your search

+2 -2
View File
@@ -76,7 +76,7 @@ public class TestBeanCache extends BaseTestCase {
List<String> sql = LoggedSqlCollector.current();
assertThat(sql).hasSize(1);
if (isH2()) {
assertThat(sql.get(0)).contains("from o_cached_bean t0 where t0.id in (?,?,?)");
assertThat(sql.get(0)).contains("from o_cached_bean t0 where t0.id in (?,?,?,?,?)");
}
log.info("All hits (3 of 3) ...");
@@ -124,7 +124,7 @@ public class TestBeanCache extends BaseTestCase {
assertThat(sql).hasSize(1);
if (isH2()) {
// fetch the misses from DB
assertThat(sql.get(0)).contains("from o_cached_bean t0 where t0.id in (?,?)");
assertThat(sql.get(0)).contains("from o_cached_bean t0 where t0.id in (?,?,?,?,?)");
}
}
@@ -0,0 +1,45 @@
package org.tests.cache;
import io.ebean.BaseTestCase;
import io.ebean.DB;
import org.junit.Test;
import org.tests.model.basic.Customer;
import org.tests.model.basic.Order;
import org.tests.model.basic.ResetBasicData;
import java.util.List;
import static io.ebean.CacheMode.ON;
public class TestBeanFetchJoinCache extends BaseTestCase {
@Test
public void test() {
ResetBasicData.reset();
// DB.find(Customer.class)
// .setBeanCacheMode(ON)
// .findList();
DB.find(Customer.class)
.where().idIn(1,2,3)
//.setBeanCacheMode(ON)
.findList();
List<Order> orders = DB.find(Order.class)
.fetchQuery("customer", "name")
.findList();
orders = DB.find(Order.class)
.fetchQuery("customer", "+cache, name")
.findList();
for (Order order : orders) {
order.getCustomer().getName();
}
}
}