private static void AddImpliedFromToFromNode(IASTNode fromClause, string collectionRole, ISessionFactoryImplementor factory)
        {
            SessionFactoryHelperExtensions _sessionFactoryHelper = new SessionFactoryHelperExtensions(factory);
            IQueryableCollection           persister             = _sessionFactoryHelper.GetCollectionPersister(collectionRole);
            IType collectionElementType = persister.ElementType;

            if (!collectionElementType.IsEntityType)
            {
                throw new QueryException("collection of values in filter: this");
            }

            string collectionElementEntityName = persister.ElementPersister.EntityName;

            ITreeAdaptor adaptor = new ASTTreeAdaptor();

            IASTNode fromElement = (IASTNode)adaptor.Create(HqlParser.FILTER_ENTITY, collectionElementEntityName);
            IASTNode alias       = (IASTNode)adaptor.Create(HqlParser.ALIAS, "this");

            fromClause.AddChild(fromElement);
            fromClause.AddChild(alias);

            // Show the modified AST.
            if (log.IsDebugEnabled())
            {
                log.Debug("AddImpliedFormToFromNode() : Filter - Added 'this' as a from element...");
            }
        }
		private static void AddImpliedFromToFromNode(IASTNode fromClause, string collectionRole, ISessionFactoryImplementor factory)
		{
			SessionFactoryHelperExtensions _sessionFactoryHelper = new SessionFactoryHelperExtensions(factory);
			IQueryableCollection persister = _sessionFactoryHelper.GetCollectionPersister(collectionRole);
			IType collectionElementType = persister.ElementType;
			if (!collectionElementType.IsEntityType)
			{
				throw new QueryException("collection of values in filter: this");
			}

			string collectionElementEntityName = persister.ElementPersister.EntityName;

			ITreeAdaptor adaptor = new ASTTreeAdaptor();

			IASTNode fromElement = (IASTNode)adaptor.Create(HqlParser.FILTER_ENTITY, collectionElementEntityName);
			IASTNode alias = (IASTNode)adaptor.Create(HqlParser.ALIAS, "this");

			fromClause.AddChild(fromElement);
			fromClause.AddChild(alias);

			// Show the modified AST.
			if (log.IsDebugEnabled)
			{
				log.Debug("AddImpliedFormToFromNode() : Filter - Added 'this' as a from element...");
			}
		}
示例#3
0
 public HqlSqlWalker(QueryTranslatorImpl qti,
                     ISessionFactoryImplementor sfi,
                     ITreeNodeStream input,
                     IDictionary <string, string> tokenReplacements,
                     string collectionRole)
     : this(input)
 {
     _sessionFactoryHelper = new SessionFactoryHelperExtensions(sfi);
     _qti = qti;
     _literalProcessor     = new LiteralProcessor(this);
     _tokenReplacements    = tokenReplacements;
     _collectionFilterRole = collectionRole;
 }
示例#4
0
		public HqlSqlWalker(QueryTranslatorImpl qti,
					  ISessionFactoryImplementor sfi,
					  ITreeNodeStream input, 
					  IDictionary<string, string> tokenReplacements,
					  string collectionRole)
			: this(input)
		{
			_sessionFactoryHelper = new SessionFactoryHelperExtensions(sfi);
			_qti = qti;
			_literalProcessor = new LiteralProcessor(this);
			_tokenReplacements = tokenReplacements;
			_collectionFilterRole = collectionRole;
		}