use of org.hibernate.hql.internal.ast.tree.IdentNode in project hibernate-orm by hibernate.
the class LiteralProcessor method processConstant.
public void processConstant(AST constant, boolean resolveIdent) throws SemanticException {
// If the constant is an IDENT, figure out what it means...
boolean isIdent = (constant.getType() == IDENT || constant.getType() == WEIRD_IDENT);
if (resolveIdent && isIdent && isAlias(constant.getText())) {
// IDENT is a class alias in the FROM.
IdentNode ident = (IdentNode) constant;
// Resolve to an identity column.
ident.resolve(false, true);
} else {
// IDENT might be the name of a class.
Queryable queryable = walker.getSessionFactoryHelper().findQueryableUsingImports(constant.getText());
if (isIdent && queryable != null) {
constant.setText(queryable.getDiscriminatorSQLValue());
} else // Otherwise, it's a literal.
{
processLiteral(constant);
}
}
}
use of org.hibernate.hql.internal.ast.tree.IdentNode in project hibernate-orm by hibernate.
the class HqlSqlWalker method resolveEntityJoinReferencedPersister.
private EntityPersister resolveEntityJoinReferencedPersister(AST path) {
if (path.getType() == IDENT) {
final IdentNode pathIdentNode = (IdentNode) path;
String name = path.getText();
if (name == null) {
name = pathIdentNode.getOriginalText();
}
return sessionFactoryHelper.findEntityPersisterByName(name);
} else if (path.getType() == DOT) {
final String pathText = ASTUtil.getPathText(path);
return sessionFactoryHelper.findEntityPersisterByName(pathText);
}
return null;
}
use of org.hibernate.hql.internal.ast.tree.IdentNode in project hibernate-orm by hibernate.
the class HqlSqlWalker method generateSyntheticDotNodeForNonQualifiedPropertyRef.
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;
}