public void setResolved() { this.resolved = true; if ( LOG.isDebugEnabled() ) { LOG.debugf( "Resolved : %s -> %s", this.getPath(), this.getText() ); } }
/** * Returns the full path of the node. * * @return the full path of the node. */ @Override public String getPath() { if ( path == null ) { FromReferenceNode lhs = getLhs(); if ( lhs == null ) { path = getText(); } else { SqlNode rhs = (SqlNode) lhs.getNextSibling(); path = lhs.getPath() + "." + rhs.getOriginalText(); } } return path; }
@Override public void prepareForDot(String propertyName) throws SemanticException { FromElement fromElement = getFromElement(); if ( fromElement == null ) { throw new IllegalStateException( "No FROM element for index operator!" ); } final QueryableCollection queryableCollection = fromElement.getQueryableCollection(); if ( queryableCollection != null && !queryableCollection.isOneToMany() ) { final FromReferenceNode collectionNode = (FromReferenceNode) getFirstChild(); final String path = collectionNode.getPath() + "[]." + propertyName; LOG.debugf( "Creating join for many-to-many elements for %s", path ); final FromElementFactory factory = new FromElementFactory( fromElement.getFromClause(), fromElement, path ); // This will add the new from element to the origin. final FromElement elementJoin = factory.createElementJoin( queryableCollection ); setFromElement( elementJoin ); } }
private AST generateSyntheticDotNodeForNonQualifiedPropertyRef(AST property, FromElement fromElement) { AST dot = getASTFactory().create( DOT, "{non-qualified-property-ref}" ); // TODO : better way?!? ( (DotNode) dot ).setPropertyPath( ( (FromReferenceNode) property ).getPath() ); IdentNode syntheticAlias = (IdentNode) getASTFactory().create( IDENT, "{synthetic-alias}" ); syntheticAlias.setFromElement( fromElement ); syntheticAlias.setResolved(); dot.setFirstChild( syntheticAlias ); dot.addChild( property ); return dot; }
private void handleElements(FromReferenceNode collectionNode, String propertyName) { FromElement collectionFromElement = collectionNode.getFromElement(); QueryableCollection queryableCollection = collectionFromElement.getQueryableCollection(); String path = collectionNode.getPath() + "[]." + propertyName; LOG.debugf( "Creating elements for %s", path ); fromElement = collectionFromElement; if ( !collectionFromElement.isCollectionOfValuesOrComponents() ) { getWalker().addQuerySpaces( queryableCollection.getElementPersister().getQuerySpaces() ); } setDataType( queryableCollection.getElementType() ); selectColumns = collectionFromElement.toColumns( fromElement.getTableAlias(), propertyName, inSelect ); }
QueryableCollection queryableCollection = sessionFactoryHelper.requireQueryableCollection( collectionRole ); if ( !queryableCollection.hasIndex() ) { throw new QueryException( "unindexed fromElement before []: " + collectionNode.getPath() ); String elementTable = fromElement.getTableAlias(); FromClause fromClause = fromElement.getFromClause(); String path = collectionNode.getPath(); String[] indexCols = queryableCollection.getIndexColumnNames(); if ( indexCols.length != 1 ) { throw new QueryException( "composite-index appears in []: " + collectionNode.getPath() );
DeprecationLogger.DEPRECATION_LOGGER.logDeprecationOfClassEntityTypeSelector( getLhs().getPath() );
public void setResolved() { this.resolved = true; if ( LOG.isDebugEnabled() ) { LOG.debugf( "Resolved : %s -> %s", this.getPath(), this.getText() ); } }
public void setResolved() { this.resolved = true; if ( LOG.isDebugEnabled() ) { LOG.debugf( "Resolved : %s -> %s", this.getPath(), this.getText() ); } }
/** * Returns the full path of the node. * * @return the full path of the node. */ @Override public String getPath() { if ( path == null ) { FromReferenceNode lhs = getLhs(); if ( lhs == null ) { path = getText(); } else { SqlNode rhs = ( SqlNode ) lhs.getNextSibling(); path = lhs.getPath() + "." + rhs.getOriginalText(); } } return path; }
/** * Returns the full path of the node. * * @return the full path of the node. */ @Override public String getPath() { if ( path == null ) { FromReferenceNode lhs = getLhs(); if ( lhs == null ) { path = getText(); } else { SqlNode rhs = ( SqlNode ) lhs.getNextSibling(); path = lhs.getPath() + "." + rhs.getOriginalText(); } } return path; }
@Override public void prepareForDot(String propertyName) throws SemanticException { FromElement fromElement = getFromElement(); if ( fromElement == null ) { throw new IllegalStateException( "No FROM element for index operator!" ); } QueryableCollection queryableCollection = fromElement.getQueryableCollection(); if ( queryableCollection != null && !queryableCollection.isOneToMany() ) { FromReferenceNode collectionNode = ( FromReferenceNode ) getFirstChild(); String path = collectionNode.getPath() + "[]." + propertyName; LOG.debugf( "Creating join for many-to-many elements for %s", path ); FromElementFactory factory = new FromElementFactory( fromElement.getFromClause(), fromElement, path ); // This will add the new from element to the origin. FromElement elementJoin = factory.createElementJoin( queryableCollection ); setFromElement( elementJoin ); } }
@Override public void prepareForDot(String propertyName) throws SemanticException { FromElement fromElement = getFromElement(); if ( fromElement == null ) { throw new IllegalStateException( "No FROM element for index operator!" ); } QueryableCollection queryableCollection = fromElement.getQueryableCollection(); if ( queryableCollection != null && !queryableCollection.isOneToMany() ) { FromReferenceNode collectionNode = ( FromReferenceNode ) getFirstChild(); String path = collectionNode.getPath() + "[]." + propertyName; LOG.debugf( "Creating join for many-to-many elements for %s", path ); FromElementFactory factory = new FromElementFactory( fromElement.getFromClause(), fromElement, path ); // This will add the new from element to the origin. FromElement elementJoin = factory.createElementJoin( queryableCollection ); setFromElement( elementJoin ); } }
private AST generateSyntheticDotNodeForNonQualifiedPropertyRef(AST property, FromElement fromElement) { AST dot = getASTFactory().create( DOT, "{non-qualified-property-ref}" ); // TODO : better way?!? ( ( DotNode ) dot ).setPropertyPath( ( ( FromReferenceNode ) property ).getPath() ); IdentNode syntheticAlias = ( IdentNode ) getASTFactory().create( IDENT, "{synthetic-alias}" ); syntheticAlias.setFromElement( fromElement ); syntheticAlias.setResolved(); dot.setFirstChild( syntheticAlias ); dot.addChild( property ); return dot; }
private AST generateSyntheticDotNodeForNonQualifiedPropertyRef(AST property, FromElement fromElement) { AST dot = getASTFactory().create( DOT, "{non-qualified-property-ref}" ); // TODO : better way?!? ( ( DotNode ) dot ).setPropertyPath( ( ( FromReferenceNode ) property ).getPath() ); IdentNode syntheticAlias = ( IdentNode ) getASTFactory().create( IDENT, "{synthetic-alias}" ); syntheticAlias.setFromElement( fromElement ); syntheticAlias.setResolved(); dot.setFirstChild( syntheticAlias ); dot.addChild( property ); return dot; }
private void handleElements(FromReferenceNode collectionNode, String propertyName) { FromElement collectionFromElement = collectionNode.getFromElement(); QueryableCollection queryableCollection = collectionFromElement.getQueryableCollection(); String path = collectionNode.getPath() + "[]." + propertyName; LOG.debugf( "Creating elements for %s", path ); fromElement = collectionFromElement; if ( !collectionFromElement.isCollectionOfValuesOrComponents() ) { getWalker().addQuerySpaces( queryableCollection.getElementPersister().getQuerySpaces() ); } setDataType( queryableCollection.getElementType() ); selectColumns = collectionFromElement.toColumns( fromElement.getTableAlias(), propertyName, inSelect ); }
private void handleElements(FromReferenceNode collectionNode, String propertyName) { FromElement collectionFromElement = collectionNode.getFromElement(); QueryableCollection queryableCollection = collectionFromElement.getQueryableCollection(); String path = collectionNode.getPath() + "[]." + propertyName; LOG.debugf( "Creating elements for %s", path ); fromElement = collectionFromElement; if ( !collectionFromElement.isCollectionOfValuesOrComponents() ) { getWalker().addQuerySpaces( queryableCollection.getElementPersister().getQuerySpaces() ); } setDataType( queryableCollection.getElementType() ); selectColumns = collectionFromElement.toColumns( fromElement.getTableAlias(), propertyName, inSelect ); }
@Override protected AST lookupProperty(AST dot, boolean root, boolean inSelect) throws SemanticException { DotNode dotNode = ( DotNode ) dot; FromReferenceNode lhs = dotNode.getLhs(); AST rhs = lhs.getNextSibling(); switch ( rhs.getType() ) { case SqlTokenTypes.ELEMENTS: case SqlTokenTypes.INDICES: if (LOG.isDebugEnabled()) LOG.debugf("lookupProperty() %s => %s(%s)", dotNode.getPath(), rhs.getText(), lhs.getPath()); CollectionFunction f = ( CollectionFunction ) rhs; // Re-arrange the tree so that the collection function is the root and the lhs is the path. f.setFirstChild( lhs ); lhs.setNextSibling( null ); dotNode.setFirstChild( f ); resolve( lhs ); // Don't forget to resolve the argument! f.resolve( inSelect ); // Resolve the collection function now. return f; default: // Resolve everything up to this dot, but don't resolve the placeholders yet. dotNode.resolveFirstChild(); return dotNode; } }
@Override protected AST lookupProperty(AST dot, boolean root, boolean inSelect) throws SemanticException { DotNode dotNode = ( DotNode ) dot; FromReferenceNode lhs = dotNode.getLhs(); AST rhs = lhs.getNextSibling(); switch ( rhs.getType() ) { case SqlTokenTypes.ELEMENTS: case SqlTokenTypes.INDICES: if (LOG.isDebugEnabled()) LOG.debugf("lookupProperty() %s => %s(%s)", dotNode.getPath(), rhs.getText(), lhs.getPath()); CollectionFunction f = ( CollectionFunction ) rhs; // Re-arrange the tree so that the collection function is the root and the lhs is the path. f.setFirstChild( lhs ); lhs.setNextSibling( null ); dotNode.setFirstChild( f ); resolve( lhs ); // Don't forget to resolve the argument! f.resolve( inSelect ); // Resolve the collection function now. return f; default: // Resolve everything up to this dot, but don't resolve the placeholders yet. dotNode.resolveFirstChild(); return dotNode; } }