@Override public String getDisplayText() { StringBuilder buf = new StringBuilder(); FromElement fromElement = getFromElement(); buf.append( "{propertyName=" ).append( propertyName ); buf.append( ",dereferenceType=" ).append( dereferenceType.name() ); buf.append( ",getPropertyPath=" ).append( propertyPath ); buf.append( ",path=" ).append( getPath() ); if ( fromElement != null ) { buf.append( ",tableAlias=" ).append( fromElement.getTableAlias() ); buf.append( ",className=" ).append( fromElement.getClassName() ); buf.append( ",classAlias=" ).append( fromElement.getClassAlias() ); } else { buf.append( ",no from element" ); } buf.append( '}' ); return buf.toString(); }
@Override public String getDisplayText() { StringBuilder buf = new StringBuilder(); if (getType() == SqlTokenTypes.ALIAS_REF) { buf.append("{alias=").append(getOriginalText()); if (getFromElement() == null) { buf.append(", no from element"); } else { buf.append(", className=").append(getFromElement().getClassName()); buf.append(", tableAlias=").append(getFromElement().getTableAlias()); } buf.append("}"); } else { buf.append( "{originalText=" ).append( getOriginalText() ).append( "}" ); } return buf.toString(); }
( ( queryableCollection == null ) ? "class" : "collection" ) + " " + ( ( queryableCollection == null ) ? fromElement.getClassName() : queryableCollection.getRole() ) );
private void dereferenceEntityIdentifier(String propertyName, DotNode dotParent) { // special shortcut for id properties, skip the join! // this must only occur at the _end_ of a path expression if ( LOG.isDebugEnabled() ) { LOG.debugf( "dereferenceShortcut() : property %s in %s does not require a join.", propertyName, getFromElement().getClassName() ); } setPropertyNameAndPath( dotParent ); // Set the unresolved path in this node and the parent. initText(); // Set the text for the parent. if ( dotParent != null ) { dotParent.dereferenceType = DereferenceType.IDENTIFIER; dotParent.setText( getText() ); dotParent.columns = getColumns(); } }
final String className = origin.getClassName();
"dereferenceEntityJoin() : generating join for %s in %s (%s) parent = %s", propertyName, getFromElement().getClassName(), classAlias == null ? "<no alias>" : classAlias, ASTUtil.getDebugString( parent ) String role = lhsFromElement.getClassName() + "." + propertyName;
if(node.getType() == SqlTokenTypes.FROM_FRAGMENT || node.getType() == SqlTokenTypes.JOIN_FRAGMENT) { FromElement id = (FromElement)node; System.out.println(node+": "+id.getClassAlias()+" - "+id.getClassName()); }
@Override public String getDisplayText() { StringBuilder buf = new StringBuilder(); FromElement fromElement = getFromElement(); buf.append( "{propertyName=" ).append( propertyName ); buf.append( ",dereferenceType=" ).append( getWalker().getASTPrinter().getTokenTypeName( dereferenceType ) ); buf.append( ",propertyPath=" ).append( propertyPath ); buf.append( ",path=" ).append( getPath() ); if ( fromElement != null ) { buf.append( ",tableAlias=" ).append( fromElement.getTableAlias() ); buf.append( ",className=" ).append( fromElement.getClassName() ); buf.append( ",classAlias=" ).append( fromElement.getClassAlias() ); } else { buf.append( ",no from element" ); } buf.append( '}' ); return buf.toString(); }
@Override public String getDisplayText() { StringBuilder buf = new StringBuilder(); FromElement fromElement = getFromElement(); buf.append( "{propertyName=" ).append( propertyName ); buf.append( ",dereferenceType=" ).append( getWalker().getASTPrinter().getTokenTypeName( dereferenceType ) ); buf.append( ",propertyPath=" ).append( propertyPath ); buf.append( ",path=" ).append( getPath() ); if ( fromElement != null ) { buf.append( ",tableAlias=" ).append( fromElement.getTableAlias() ); buf.append( ",className=" ).append( fromElement.getClassName() ); buf.append( ",classAlias=" ).append( fromElement.getClassAlias() ); } else { buf.append( ",no from element" ); } buf.append( '}' ); return buf.toString(); }
QueryTranslator[] translators = hqlPlan.getTranslators(); AST ast = (AST)((QueryTranslatorImpl)translators[0]).getSqlAST(); new NodeTraverser(new NodeTraverser.VisitationStrategy() { public void visit(AST node) { if(node.getType() == SqlTokenTypes.FROM_FRAGMENT || node.getType() == SqlTokenTypes.JOIN_FRAGMENT) { FromElement id = (FromElement)node; System.out.println(node+": "+id.getClassAlias()+" - "+id.getClassName()); } } }).traverseDepthFirst(ast);
@Override public String getDisplayText() { StringBuffer buf = new StringBuffer(); if (getType() == SqlTokenTypes.ALIAS_REF) { buf.append("{alias=").append(getOriginalText()); if (getFromElement() == null) { buf.append(", no from element"); } else { buf.append(", className=").append(getFromElement().getClassName()); buf.append(", tableAlias=").append(getFromElement().getTableAlias()); } buf.append("}"); } else { buf.append("{originalText=" + getOriginalText()).append("}"); } return buf.toString(); }
@Override public String getDisplayText() { StringBuffer buf = new StringBuffer(); if (getType() == SqlTokenTypes.ALIAS_REF) { buf.append("{alias=").append(getOriginalText()); if (getFromElement() == null) { buf.append(", no from element"); } else { buf.append(", className=").append(getFromElement().getClassName()); buf.append(", tableAlias=").append(getFromElement().getTableAlias()); } buf.append("}"); } else { buf.append("{originalText=" + getOriginalText()).append("}"); } return buf.toString(); }
/** * Returns the type of a property, given it's name (the last part) and the full path. * * @param propertyName The last part of the full path to the property. * @return The type. * @0param propertyPath The full property path. */ public Type getPropertyType(String propertyName, String propertyPath) { checkInitialized(); Type type = null; // If this is an entity and the property is the identifier property, then use getIdentifierType(). // Note that the propertyName.equals( propertyPath ) checks whether we have a component // key reference, where the component class property name is the same as the // entity id property name; if the two are not equal, this is the case and // we'd need to "fall through" to using the property mapping. if ( persister != null && propertyName.equals( propertyPath ) && propertyName.equals( persister.getIdentifierPropertyName() ) ) { type = persister.getIdentifierType(); } else { // Otherwise, use the property mapping. PropertyMapping mapping = getPropertyMapping( propertyName ); type = mapping.toType( propertyPath ); } if ( type == null ) { throw new MappingException( "Property " + propertyName + " does not exist in " + ( ( queryableCollection == null ) ? "class" : "collection" ) + " " + ( ( queryableCollection == null ) ? fromElement.getClassName() : queryableCollection.getRole() ) ); } return type; }
/** * Returns the type of a property, given it's name (the last part) and the full path. * * @param propertyName The last part of the full path to the property. * @return The type. * @0param propertyPath The full property path. */ public Type getPropertyType(String propertyName, String propertyPath) { checkInitialized(); Type type = null; // If this is an entity and the property is the identifier property, then use getIdentifierType(). // Note that the propertyName.equals( propertyPath ) checks whether we have a component // key reference, where the component class property name is the same as the // entity id property name; if the two are not equal, this is the case and // we'd need to "fall through" to using the property mapping. if ( persister != null && propertyName.equals( propertyPath ) && propertyName.equals( persister.getIdentifierPropertyName() ) ) { type = persister.getIdentifierType(); } else { // Otherwise, use the property mapping. PropertyMapping mapping = getPropertyMapping( propertyName ); type = mapping.toType( propertyPath ); } if ( type == null ) { throw new MappingException( "Property " + propertyName + " does not exist in " + ( ( queryableCollection == null ) ? "class" : "collection" ) + " " + ( ( queryableCollection == null ) ? fromElement.getClassName() : queryableCollection.getRole() ) ); } return type; }
private void dereferenceEntityIdentifier(String propertyName, DotNode dotParent) { // special shortcut for id properties, skip the join! // this must only occur at the _end_ of a path expression if ( LOG.isDebugEnabled() ) { LOG.debugf( "dereferenceShortcut() : property %s in %s does not require a join.", propertyName, getFromElement().getClassName() ); } initText(); setPropertyNameAndPath( dotParent ); // Set the unresolved path in this node and the parent. // Set the text for the parent. if ( dotParent != null ) { dotParent.dereferenceType = DEREF_IDENTIFIER; dotParent.setText( getText() ); dotParent.columns = getColumns(); } }
private void dereferenceEntityIdentifier(String propertyName, DotNode dotParent) { // special shortcut for id properties, skip the join! // this must only occur at the _end_ of a path expression if ( LOG.isDebugEnabled() ) { LOG.debugf( "dereferenceShortcut() : property %s in %s does not require a join.", propertyName, getFromElement().getClassName() ); } initText(); setPropertyNameAndPath( dotParent ); // Set the unresolved path in this node and the parent. // Set the text for the parent. if ( dotParent != null ) { dotParent.dereferenceType = DEREF_IDENTIFIER; dotParent.setText( getText() ); dotParent.columns = getColumns(); } }
if (LOG.isDebugEnabled()) LOG.debugf("dereferenceEntityJoin() : generating join for %s in %s (%s) parent = %s", propertyName, getFromElement().getClassName(), classAlias == null ? "<no alias>" : classAlias, ASTUtil.getDebugString(parent));
if (LOG.isDebugEnabled()) LOG.debugf("dereferenceEntityJoin() : generating join for %s in %s (%s) parent = %s", propertyName, getFromElement().getClassName(), classAlias == null ? "<no alias>" : classAlias, ASTUtil.getDebugString(parent));