public virtual IQuery GetNamedQuery(string queryName)
 {
     using (new SessionIdLoggingContext(SessionId))
     {
         CheckAndUpdateSessionStatus();
         NamedQueryDefinition nqd = factory.GetNamedQuery(queryName);
         IQuery query;
         if (nqd != null)
         {
             string queryString = nqd.QueryString;
             query = new QueryImpl(queryString, nqd.FlushMode, this, GetHQLQueryPlan(queryString.ToQueryExpression(), false).ParameterMetadata);
             query.SetComment("named HQL query " + queryName);
         }
         else
         {
             NamedSQLQueryDefinition nsqlqd = factory.GetNamedSQLQuery(queryName);
             if (nsqlqd == null)
             {
                 throw new MappingException("Named query not known: " + queryName);
             }
             query = new SqlQueryImpl(nsqlqd, this,
                                      factory.QueryPlanCache.GetSQLParameterMetadata(nsqlqd.QueryString));
             query.SetComment("named native SQL query " + queryName);
             nqd = nsqlqd;
         }
         InitQuery(query, nqd);
         return(query);
     }
 }
 public virtual IQuery CreateQuery(string queryString)
 {
     using (new SessionIdLoggingContext(SessionId))
     {
         CheckAndUpdateSessionStatus();
         QueryImpl query = new QueryImpl(queryString, this, GetHQLQueryPlan(queryString, false).ParameterMetadata);
         query.SetComment(queryString);
         return(query);
     }
 }
Example #3
0
			public override IQuery GetExecutableQuery(ISession session)
			{
				var result = base.GetExecutableQuery(session);
				queryExecutable = (QueryImpl)result;
				return result;
			}