public virtual IQuery GetNamedSQLQuery(string name)
 {
     using (new SessionIdLoggingContext(SessionId))
     {
         CheckAndUpdateSessionStatus();
         NamedSQLQueryDefinition nsqlqd = factory.GetNamedSQLQuery(name);
         if (nsqlqd == null)
         {
             throw new MappingException("Named SQL query not known: " + name);
         }
         IQuery query = new SqlQueryImpl(nsqlqd, this,
                                         factory.QueryPlanCache.GetSQLParameterMetadata(nsqlqd.QueryString));
         query.SetComment("named native SQL query " + name);
         InitQuery(query, nsqlqd);
         return(query);
     }
 }
        private void SetDefaultProperties(ISessionFactoryImplementor factory)
        {
            NamedQueryDefinition nqd = factory.GetNamedQuery(queryName) ?? factory.GetNamedSQLQuery(queryName);

            if (!cacheableWasSet)
            {
                cacheable = nqd.IsCacheable;
            }

            if (!cacheRegionWasSet)
            {
                cacheRegion = nqd.CacheRegion;
            }

            if (!timeoutWasSet && nqd.Timeout != -1)
            {
                selection.Timeout = nqd.Timeout;
            }

            if (!fetchSizeWasSet && nqd.FetchSize != -1)
            {
                selection.FetchSize = nqd.FetchSize;
            }

            if (!cacheModeWasSet && nqd.CacheMode.HasValue)
            {
                cacheMode = nqd.CacheMode.Value;
            }

            if (!readOnlyWasSet)
            {
                readOnly = nqd.IsReadOnly;
            }

            if (!commentWasSet && nqd.Comment != null)
            {
                comment = nqd.Comment;
            }

            if (!flushModeWasSet)
            {
                flushMode = nqd.FlushMode;
            }
        }
		private void SetDefaultProperties(ISessionFactoryImplementor factory)
		{
			NamedQueryDefinition nqd = factory.GetNamedQuery(queryName) ?? factory.GetNamedSQLQuery(queryName);

			if (!cacheableWasSet)
			{
				cacheable = nqd.IsCacheable;
			}

			if (!cacheRegionWasSet)
			{
				cacheRegion = nqd.CacheRegion;
			}

			if(!timeoutWasSet && nqd.Timeout != -1)
			{
				selection.Timeout= nqd.Timeout;
			}

			if (!fetchSizeWasSet && nqd.FetchSize != -1)
			{
				selection.FetchSize = nqd.FetchSize;
			}

			if (!cacheModeWasSet && nqd.CacheMode.HasValue)
			{
				cacheMode = nqd.CacheMode.Value;
			}

			if (!readOnlyWasSet)
			{
				readOnly = nqd.IsReadOnly;
			}

			if (!commentWasSet && nqd.Comment != null)
			{
				comment = nqd.Comment;
			}

			if(!flushModeWasSet)
			{
				flushMode = nqd.FlushMode;
			}
		}