title: How to skip second level cache in query?
body: <p>I use entity cache (second level cache) for an object. Now, in one specific query (I use OueryOver) I need to sidestep the second level cache. I have tried to omit the "Cacheable" attribute in my query but the query is still cached, through the second level cache I assume.</p>
  
  <p>My runtime:</p>
  
  <p>.NET 4.0
  NHibernate: 3.1.0.4000
  Fluent NHiberante: 1.2.0.712</p>
  
  <p>My object:</p>
  
  <pre><code>[Serializable]
  public class ArticleWishListItem : EntityBase&lt;int&gt;
  {
      public virtual int CustomerId { get; set; }
      public virtual int ArticleId { get; set; }
      public virtual DateTime CreatedDate { get; set;  }
  }
  </code></pre>
  
  <p>My mapping:</p>
  
  <pre><code>public class ArticleWishListItemMapping : ClassMap&lt;ArticleWishListItem&gt;
  {
      public ArticleWishListItemMapping()
      {
          Cache.ReadWrite().Region("WishList");
  
          Id(a =&gt; a.Id).GeneratedBy.Native();
  
          Map(a =&gt; a.ArticleId).Not.Nullable();
          Map(a =&gt; a.CreatedDate).Not.Nullable();
          Map(a =&gt; a.CustomerId).Not.Nullable();
      }
  }
  </code></pre>
  
  <p>My query where results are cached contrary to my wish:</p>
  
  <pre><code>    private static List&lt;ArticleWishListItem&gt; GetArticleWishListItemsImplementation(NHibernate.ISession session, int customerId)
      {
          return session.QueryOver&lt;ArticleWishListItem&gt;()
                                         .Where(a =&gt; a.CustomerId == customerId)
                                         .List&lt;ArticleWishListItem&gt;()
                                         .ToList&lt;ArticleWishListItem&gt;();
      }
  </code></pre>
  
  <p>What is the best way to make this query hit the database every time even though I want to have the the caching enabled for the entity? I can use IStatelessSession and it would work in this case because it skips the second level cache, but is it the recommended solution?</p>