private void addCollectionFromElement(FromElement fromElement) { if (fromElement.isFetch()) { if (fromElement.getQueryableCollection() != null) { String suffix; if (collectionFromElements == null) { collectionFromElements = new ArrayList(); suffix = VERSION2_SQL ? "__" : "0__"; } else { suffix = Integer.toString(collectionFromElements.size()) + "__"; } collectionFromElements.add(fromElement); fromElement.setCollectionSuffix(suffix); } } }
private void handleElements(FromReferenceNode collectionNode, String propertyName) { FromElement collectionFromElement = collectionNode.getFromElement(); QueryableCollection queryableCollection = collectionFromElement.getQueryableCollection(); String path = collectionNode.getPath() + "[]." + propertyName; log.debug("Creating elements for " + path); fromElement = collectionFromElement; if (!collectionFromElement.isCollectionOfValuesOrComponents()) { getWalker().addQuerySpaces(queryableCollection.getElementPersister().getQuerySpaces()); } setDataType(queryableCollection.getElementType()); selectColumns = collectionFromElement.toColumns(fromElement.getTableAlias(), propertyName, inSelect); }
private void renderNonScalarProperties( ASTAppender appender, FromElement fromElement, int nonscalarSize, int k) { String text = fromElement.renderPropertySelect(nonscalarSize, k); appender.append(SqlTokenTypes.SQL_TOKEN, text, false); if (fromElement.getQueryableCollection() != null && fromElement.isFetch()) { text = fromElement.renderCollectionSelectFragment(nonscalarSize, k); appender.append(SqlTokenTypes.SQL_TOKEN, text, false); } // Look through the FromElement's children to find any collections of values that should be // fetched... ASTIterator iter = new ASTIterator(fromElement); while (iter.hasNext()) { FromElement child = (FromElement) iter.next(); if (child.isCollectionOfValuesOrComponents() && child.isFetch()) { // Need a better way to define the suffixes here... text = child.renderValueCollectionSelectFragment(nonscalarSize, nonscalarSize + k); appender.append(SqlTokenTypes.SQL_TOKEN, text, false); } } }
public boolean include(AST node) { FromElement fromElement = (FromElement) node; return fromElement.isFetch() && fromElement.getQueryableCollection() != null; }