private PrefetchProcessorNode createDisjointNode(PrefetchTreeNode node) { // TODO, Andrus, 11/16/2005 - minor inefficiency: 'adjacentJointNodes' // would // grab ALL nodes, we just need to find first and stop... PrefetchProcessorNode decorated = !node.adjacentJointNodes().isEmpty() ? new PrefetchProcessorJointNode( getParent(), node.getName()) : new PrefetchProcessorNode(getParent(), node.getName()); decorated.setPhantom(false); return decorated; }
public boolean startDisjointPrefetch(PrefetchTreeNode node) { // look ahead for joint children as joint children will require a different // node type. // TODO, Andrus, 11/16/2005 - minor inefficiency: 'adjacentJointNodes' would // grab ALL nodes, we just need to find first and stop... PrefetchProcessorNode decorated = !node.adjacentJointNodes().isEmpty() ? decorated = new PrefetchProcessorJointNode(getParent(), node .getName()) : new PrefetchProcessorNode(getParent(), node.getName()); decorated.setPhantom(false); // semantics has to be "DISJOINT" even if the node is joint, as semantics // defines relationship with parent.. decorated.setSemantics(PrefetchTreeNode.DISJOINT_PREFETCH_SEMANTICS); return addNode(decorated); }
.adjacentJointNodes() .iterator();
private void addPrefetchedColumnsIfAny(final String visitedIdentifier) { PrefetchTreeNode prefetchTree = context.getCompiledExpression().getPrefetchTree(); if (prefetchTree != null) { for (PrefetchTreeNode prefetch : prefetchTree.adjacentJointNodes()) { ClassDescriptor descriptor = context.getEntityDescriptor(prefetch.getEjbqlPathEntityId()); if (visitedIdentifier.equals(prefetch.getEjbqlPathEntityId())) { DbEntity table = descriptor.getRootDbEntities().iterator().next(); ObjEntity objectEntity = descriptor.getEntity(); prefetch.setEntityName(objectEntity.getName()); Expression prefetchExp = ExpressionFactory.exp(prefetch.getPath()); Expression dbPrefetch = objectEntity.translateToDbPath(prefetchExp); DbRelationship r = null; for (PathComponent<DbAttribute, DbRelationship> component : table.resolvePath(dbPrefetch, context .getMetadata().getPathSplitAliases())) { r = component.getRelationship(); } if (r == null) { throw new CayenneRuntimeException("Invalid joint prefetch '%s' for entity: %s" , prefetch, objectEntity.getName()); } for (DbAttribute attribute : r.getTargetEntity().getAttributes()) { appendColumn(prefetch.getEjbqlPathEntityId() + "." + prefetch.getPath(), attribute, "", prefetch.getPath() + "." + attribute.getName(), null); } } } } }
for (PrefetchTreeNode prefetch : query.getPrefetchTree().adjacentJointNodes()) {
for (PrefetchTreeNode prefetch : query.getPrefetchTree().adjacentJointNodes()) {