FromElement addFromElement() throws SemanticException {
    final FromClause parentFromClause = fromClause.getParentFromClause();
    if (parentFromClause != null) {
      // Look up class name using the first identifier in the path.
      final String pathAlias = PathHelper.getAlias(path);
      final FromElement parentFromElement = parentFromClause.getFromElement(pathAlias);
      if (parentFromElement != null) {
        return createFromElementInSubselect(path, pathAlias, parentFromElement, classAlias);
      }
    }

    final EntityPersister entityPersister =
        fromClause.getSessionFactoryHelper().requireClassPersister(path);

    final FromElement elem =
        createAndAddFromElement(
            path,
            classAlias,
            entityPersister,
            (EntityType) ((Queryable) entityPersister).getType(),
            null);

    // Add to the query spaces.
    fromClause.getWalker().addQuerySpaces(entityPersister.getQuerySpaces());

    return elem;
  }
 private FromElement evaluateFromElementPath(String path, String classAlias)
     throws SemanticException {
   ASTFactory factory = fromClause.getASTFactory();
   FromReferenceNode pathNode = (FromReferenceNode) PathHelper.parsePath(path, factory);
   pathNode.recursiveResolve(
       // This is the root level node.
       FromReferenceNode.ROOT_LEVEL,
       // Generate an explicit from clause at the root.
       false,
       classAlias,
       null);
   if (pathNode.getImpliedJoin() != null) {
     return pathNode.getImpliedJoin();
   }
   return pathNode.getFromElement();
 }