Exemple #1
0
 public override void List(string query, QueryParameters queryParameters, IList results)
 {
     using (new SessionIdLoggingContext(SessionId))
     {
         CheckAndUpdateSessionStatus();
         queryParameters.ValidateParameters();
         var  plan    = GetHQLQueryPlan(query, false);
         bool success = false;
         try
         {
             plan.PerformList(queryParameters, this, results);
             success = true;
         }
         catch (HibernateException)
         {
             // Do not call Convert on HibernateExceptions
             throw;
         }
         catch (Exception e)
         {
             throw Convert(e, "Could not execute query");
         }
         finally
         {
             AfterOperation(success);
         }
         temporaryPersistenceContext.Clear();
     }
 }
Exemple #2
0
        public override void List(IQueryExpression queryExpression, QueryParameters queryParameters, IList results)
        {
            using (BeginProcess())
            {
                queryParameters.ValidateParameters();
                var plan = GetHQLQueryPlan(queryExpression, false);

                bool success = false;
                try
                {
                    plan.PerformList(queryParameters, this, results);
                    success = true;
                }
                catch (HibernateException)
                {
                    // Do not call Convert on HibernateExceptions
                    throw;
                }
                catch (Exception e)
                {
                    throw Convert(e, "Could not execute query");
                }
                finally
                {
                    AfterOperation(success);
                }
                temporaryPersistenceContext.Clear();
            }
        }
        public override void List(IQueryExpression queryExpression, QueryParameters queryParameters, IList results)
        {
            using (BeginProcess())
            {
                // We need to flush the batcher. Otherwise it may have pending operations which will not already have reached the database,
                // and the query may yield stale data.
                Flush();

                queryParameters.ValidateParameters();
                var plan = GetHQLQueryPlan(queryExpression, false);

                bool success = false;
                try
                {
                    plan.PerformList(queryParameters, this, results);
                    success = true;
                }
                catch (HibernateException)
                {
                    // Do not call Convert on HibernateExceptions
                    throw;
                }
                catch (Exception e)
                {
                    throw Convert(e, "Could not execute query");
                }
                finally
                {
                    AfterOperation(success);
                }
                temporaryPersistenceContext.Clear();
            }
        }