For #2038 - updated from 12.3.6 to 12.3.7 - NPE BeanDescriptor.findPropertyFromPath(BeanDescriptor.java:1965) (#2047)

* #2038 - lazy loading ToMany with path

* #2038 - Failing test for NPE BeanDescriptor.findPropertyFromPath(BeanDescriptor.java:1965)

* #2038 Refactor internals DbReadContext use BeanPropertyAssocMany
This commit is contained in:
Rob Bygrave
2020-08-24 18:40:36 +12:00
committed by GitHub
parent c8d352b0a8
commit 002014f930
15 changed files with 212 additions and 22 deletions
@@ -5,6 +5,7 @@ import io.ebean.FetchConfig;
import io.ebean.Query;
import io.ebeaninternal.server.core.OrmQueryRequest;
import io.ebeaninternal.server.core.OrmQueryRequestTestHelper;
import io.ebeaninternal.server.deploy.BeanPropertyAssocMany;
import org.tests.model.basic.Order;
import org.junit.Test;
@@ -94,13 +95,14 @@ public class DLoadContextTest extends BaseTestCase {
@Test
public void construct_when_fetch_expect_100_100_batchSize() {
BeanPropertyAssocMany<?> many = (BeanPropertyAssocMany<?>)getBeanDescriptor(Order.class).getBeanProperty("details");
// the fetch is converted to a query join due to the maxRows
OrmQueryRequest<Order> queryRequest = queryRequest(query().fetch("details").setMaxRows(100));
queryRequest.initTransIfRequired();
queryRequest.endTransIfRequired();
DLoadContext graphContext = (DLoadContext) queryRequest.getGraphContext();
DLoadManyContext details = graphContext.getManyContext("details");
DLoadManyContext details = graphContext.getManyContext("details", many);
assertThat(details.firstBatchSize).isEqualTo(100);
assertThat(details.secondaryBatchSize).isEqualTo(100);