/** * Setup the load context at this path with OrmQueryProperties which is used to build the * appropriate query for +query or +lazy loading. */ private void registerSecondaryQuery(OrmQueryProperties props) { String propName = props.getPath(); ElPropertyValue elGetValue = rootDescriptor.getElGetValue(propName); boolean many = elGetValue.getBeanProperty().containsMany(); registerSecondaryNode(many, props); }
private void registerSecondaryNode(boolean many, OrmQueryProperties props) { String path = props.getPath(); int lazyJoinBatch = props.getLazyFetchBatch(); int batchSize = lazyJoinBatch > 0 ? lazyJoinBatch : defaultBatchSize; if (many) { DLoadManyContext manyContext = createManyContext(path, batchSize, props); manyMap.put(path, manyContext); } else { DLoadBeanContext beanContext = createBeanContext(path, batchSize, props); beanMap.put(path, beanContext); } }
/** Execute all the secondary queries. */ public void executeSecondaryQueries(OrmQueryRequest<?> parentRequest, int defaultQueryBatch) { if (secQuery != null) { for (int i = 0; i < secQuery.size(); i++) { OrmQueryProperties properties = secQuery.get(i); int batchSize = properties.getQueryFetchBatch(); if (batchSize == 0) { batchSize = defaultQueryBatch; } LoadSecondaryQuery load = getLoadSecondaryQuery(properties.getPath()); load.loadSecondaryQuery(parentRequest, batchSize, properties.isQueryFetchAll()); } } }