private int initSecondaryBatchSize(int defaultBatchSize, int firstBatchSize, OrmQueryProperties queryProps) { if (queryProps == null) { return defaultBatchSize; } FetchConfig fetchConfig = queryProps.getFetchConfig(); if (fetchConfig.isQueryAll()) { return firstBatchSize; } int lazyBatchSize = fetchConfig.getLazyBatchSize(); return (lazyBatchSize > 1) ? lazyBatchSize : defaultBatchSize; }
/** * Define the select and joins for this query. */ @SuppressWarnings("unchecked") public void configureManyQuery(SpiQuery<?> query) { if (trimmedProperties != null && trimmedProperties.length() > 0) { query.fetch(query.getLazyLoadManyPath(), trimmedProperties); } if (filterMany != null){ query.setFilterMany(path, filterMany); } if (secondaryChildren != null) { int trimlen = path.length() - query.getLazyLoadManyPath().length(); for (int i = 0; i < secondaryChildren.size(); i++) { OrmQueryProperties p = secondaryChildren.get(i); String path = p.getPath(); path = path.substring(trimlen); query.fetch(path, p.getProperties(), p.getFetchConfig()); query.setFilterMany(path, p.getFilterManyTrimPath(trimlen)); } } if (orderBy != null){ query.setOrder(orderBy); } }
/** * Define the select and joins for this query. */ @SuppressWarnings("unchecked") public void configureManyQuery(SpiQuery<?> query) { if (trimmedProperties != null && trimmedProperties.length() > 0) { query.fetch(query.getLazyLoadManyPath(), trimmedProperties); } if (filterMany != null){ query.setFilterMany(path, filterMany); } if (secondaryChildren != null) { int trimlen = path.length() - query.getLazyLoadManyPath().length(); for (int i = 0; i < secondaryChildren.size(); i++) { OrmQueryProperties p = secondaryChildren.get(i); String path = p.getPath(); path = path.substring(trimlen); query.fetch(path, p.getProperties(), p.getFetchConfig()); query.setFilterMany(path, p.getFilterManyTrimPath(trimlen)); } } if (orderBy != null){ query.setOrder(orderBy); } }
/** * Define the select and joins for this query. */ @SuppressWarnings("unchecked") public void configureBeanQuery(SpiQuery<?> query) { if (trimmedProperties != null && trimmedProperties.length() > 0) { query.select(trimmedProperties); if (filterMany != null){ query.setFilterMany(path, filterMany); } } if (secondaryChildren != null) { int trimPath = path.length() + 1; for (int i = 0; i < secondaryChildren.size(); i++) { OrmQueryProperties p = secondaryChildren.get(i); String path = p.getPath(); path = path.substring(trimPath); query.fetch(path, p.getProperties(), p.getFetchConfig()); query.setFilterMany(path, p.getFilterManyTrimPath(trimPath)); } } if (orderBy != null){ List<Property> orderByProps = orderBy.getProperties(); for (int i = 0; i < orderByProps.size(); i++) { orderByProps.get(i).trim(path); } query.setOrder(orderBy); } }
/** * Define the select and joins for this query. */ @SuppressWarnings("unchecked") public void configureBeanQuery(SpiQuery<?> query) { if (trimmedProperties != null && trimmedProperties.length() > 0) { query.select(trimmedProperties); if (filterMany != null){ query.setFilterMany(path, filterMany); } } if (secondaryChildren != null) { int trimPath = path.length() + 1; for (int i = 0; i < secondaryChildren.size(); i++) { OrmQueryProperties p = secondaryChildren.get(i); String path = p.getPath(); path = path.substring(trimPath); query.fetch(path, p.getProperties(), p.getFetchConfig()); query.setFilterMany(path, p.getFilterManyTrimPath(trimPath)); } } if (orderBy != null){ List<Property> orderByProps = orderBy.getProperties(); for (int i = 0; i < orderByProps.size(); i++) { orderByProps.get(i).trim(path); } query.setOrder(orderBy); } }
/** * Define the select and joins for this query. */ @SuppressWarnings("unchecked") public void configureBeanQuery(SpiQuery<?> query) { if (trimmedProperties != null && !trimmedProperties.isEmpty()) { query.select(trimmedProperties); } if (filterMany != null) { SpiExpressionList<?> trimPath = filterMany.trimPath(path.length() + 1); List<SpiExpression> underlyingList = trimPath.getUnderlyingList(); for (SpiExpression spiExpression : underlyingList) { query.where().add(spiExpression); } } if (secondaryChildren != null) { int trimPath = path.length() + 1; for (OrmQueryProperties p : secondaryChildren) { String path = p.getPath(); path = path.substring(trimPath); query.fetch(path, p.getProperties(), p.getFetchConfig()); query.setFilterMany(path, p.getFilterManyTrimPath(trimPath)); } } if (orderBy != null) { query.setOrder(orderBy.copyWithTrim(path)); } }
/** * Set any default select clauses for the main bean and any joins that have not explicitly defined * a select clause. * <p> * That is this will use FetchType.LAZY to exclude some properties by default. * </p> */ public void setDefaultSelectClause(BeanDescriptor<?> desc) { if (desc.hasDefaultSelectClause() && !hasSelectClause()) { baseProps = new OrmQueryProperties(null, desc.getDefaultSelectClause()); } for (OrmQueryProperties joinProps : fetchPaths.values()) { if (!joinProps.hasSelectClause()) { BeanDescriptor<?> assocDesc = desc.getBeanDescriptor(joinProps.getPath()); if (assocDesc.hasDefaultSelectClause()) { fetch(joinProps.getPath(), assocDesc.getDefaultSelectClause(), joinProps.getFetchConfig()); } } } }