Ejemplo n.º 1
0
        private FromElement CreateCollectionJoin(JoinSequence collectionJoinSequence, string tableAlias)
        {
            string      text        = _queryableCollection.TableName;
            IASTNode    ast         = CreateFromElement(text);
            FromElement destination = (FromElement)ast;
            IType       elementType = _queryableCollection.ElementType;

            if (elementType.IsCollectionType)
            {
                throw new SemanticException("Collections of collections are not supported!");
            }

            destination.InitializeCollection(_fromClause, _classAlias, tableAlias);
            destination.Type = HqlSqlWalker.JOIN_FRAGMENT;              // Tag this node as a JOIN.
            destination.SetIncludeSubclasses(false);                    // Don't include subclasses in the join.
            destination.CollectionJoin = true;                          // This is a clollection join.
            destination.JoinSequence   = collectionJoinSequence;
            destination.SetOrigin(_origin, false);
            destination.CollectionTableAlias = tableAlias;
            //		origin.addDestination( destination );
            // This was the cause of HHH-242
            //		origin.setType( FROM_FRAGMENT );			// Set the parent node type so that the AST is properly formed.
            _origin.Text           = "";                                // The destination node will have all the FROM text.
            _origin.CollectionJoin = true;                              // The parent node is a collection join too (voodoo - see JoinProcessor)
            _fromClause.AddCollectionJoinFromElementByPath(_path, destination);
            _fromClause.Walker.AddQuerySpaces(_queryableCollection.CollectionSpaces);
            return(destination);
        }