@Override public DefaultOrmQuery<T> fetch(String property, String columns, FetchConfig config) { detail.fetch(property, columns, config); return this; }
/** * Set the fetch properties and configuration for a given path. * * @param path the property to join * @param partialProps the properties on the join property to include */ public void fetch(String path, String partialProps, FetchConfig fetchConfig) { fetch(new OrmQueryProperties(path, partialProps, fetchConfig)); }
/** * Add for raw sql etc when the properties are already parsed into a set. */ public void fetch(String path, LinkedHashSet<String> properties) { fetch(new OrmQueryProperties(path, properties)); }
public OrmQueryProperties getChunk(String path, boolean create) { if (path == null) { return baseProps; } OrmQueryProperties props = fetchPaths.get(path); if (create && props == null) { props = new OrmQueryProperties(path); fetch(props); return props; } else { return props; } }
boolean tuneFetchProperties(OrmQueryDetail tunedDetail) { boolean tuned = false; OrmQueryProperties tunedRoot = tunedDetail.getChunk(null, false); if (tunedRoot != null) { tuned = true; baseProps = tunedRoot; for (OrmQueryProperties tunedChunk : tunedDetail.fetchPaths.values()) { fetch(tunedChunk.copy()); } } return tuned; }
private void process() { if (isFetch()) { detail.fetch(readFindFetch()); } else { throw new PersistenceException("Query expected 'fetch', 'where','order by' or 'limit' keyword but got [" + parser.getWord() + "] \r " + parser.getOql()); } }
private OrmQueryDetail buildDetail(BeanDescriptor<?> rootDesc) { PathProperties pathProps = new PathProperties(); for (ProfileOriginNodeUsage statsNode : nodeUsageMap.values()) { statsNode.buildTunedFetch(pathProps, rootDesc, queryTuningAddVersion); } OrmQueryDetail detail = new OrmQueryDetail(); Collection<Props> pathProperties = pathProps.getPathProps(); for (Props props : pathProperties) { if (!props.isEmpty()) { detail.fetch(props.getPath(), props.getPropertiesAsString(), null); } } detail.sortFetchPaths(rootDesc); return detail; }
/** * 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()); } } } }
detail.fetch(props.getPath(), props.getProperties());