title: Nhibernate QueryOver don't get latest database changes
body: <p>I am trying get a record updated from database with <code>QueryOver</code>.
  My code initially creates an entity and saves in database, then the same record is updated on database externally( from other program, manually or the same program running in other machine), and when I call <code>queryOver</code> filtering by the field changed, the query gets the record but <em>without</em> latest changes.</p>
  <p>This is my code:</p>
  <pre><code>//create the entity and save in database
  MyEntity myEntity = CreateDummyEntity();
  myEntity.Name = &quot;new_name&quot;;
  
  MyService.SaveEntity(myEntity);
  
  // now the entity is updated externally changing the name property with the 
  // &quot;modified_name&quot; value (for example manually in TOAD, SQL Server,etc..)
  
  //get the entity with QueryOver
  var result = NhibernateHelper.Session
                   .QueryOver&lt;MyEntity&gt;()
                   .Where(param =&gt; param.Name == &quot;modified_name&quot;)
                   .List&lt;T&gt;();
  </code></pre>
  <p>The previous statement gets a collection with only one record(good), <strong>BUT</strong> with the name property established <strong>with the old value</strong> instead of &quot;modified_name&quot;.</p>
  <p>How I can fix this behaviour? First Level cache is disturbing me? The same problem occurs with</p>
  <pre><code>CreateCriteria&lt;T&gt;();
  </code></pre>
  <p>The session in my NhibernateHelper is not being closed in any moment due application framework requirements, only are created transactions for each commit associated to a session.Save().
  If I open a new session to execute the query evidently I get the latest changes from database, but this approach is not allowed by design requirement.</p>
  <p>Also I have checked in the NHibernate SQL output that a select with a WHERE clause is being executed (therefore Nhibernate hits the database) but don´t updates the  returned object!!!!</p>
  <h2>UPDATE</h2>
  <p>Here's the code in SaveEntity after to call session.Save: A call to Commit method is done</p>
  <pre><code>public virtual void Commit() 
  { 
    try 
    { 
      this.session.Flush(); 
      this.transaction.Commit();
    } 
    catch 
    { 
      this.transaction.Rollback(); 
      throw; 
    } 
    finally 
    { 
      this.transaction = this.session.BeginTransaction();
    } 
  }
  </code></pre>
  <p>The SQL generated by NHibernate for SaveEntity:</p>
  <pre><code>NHibernate: INSERT INTO MYCOMPANY.MYENTITY (NAME) VALUES (:p0);:p0 = 'new_name'. 
  </code></pre>
  <p>The SQL generated by NHibernate for QueryOver:</p>
  <pre><code>NHibernate: SELECT this_.NAME as NAME26_0_ 
              FROM MYCOMPANY.MYENTITY this_ 
              WHERE this_.NAME = :p0;:p0 = 'modified_name' [Type: String (0)]. 
  </code></pre>
  <p>Queries has been modified due to company confidential policies.</p>
  <p>Help very appreciated.</p>