title: NHibernate session is not caching
body: <p>I am relatively new for Nhibernate and I am having a problem caching the entities in the session( first level cache)
  Here is my code</p>
  
  <pre><code>public Book IProductRepository.GetBookbyName(string bookName)
  {
          ISession session = NHibernateHelper.GetSession();
          ICriteria criteria = session.CreateCriteria&lt;Book&gt;()
                                       .Add(Restrictions.Eq("Name", bookName));
          return criteria.UniqueResult&lt;Book&gt;();
  }
  </code></pre>
  
  <p>and </p>
  
  <p>private static ISessionFactory _sessionFactory;</p>
  
  <pre><code>    private static ISessionFactory SessionFactory
      {
          get
          {
              if (_sessionFactory == null)
              {
                  var configuration = new Configuration();
                  configuration.Configure();
                  configuration.AddAssembly(typeof(Product).Assembly);
                  _sessionFactory = configuration.BuildSessionFactory();
                  CurrentSessionContext.Bind(_sessionFactory.OpenSession());
              }
              return _sessionFactory;
          }
      }
  
  
      public static ISession GetSession()
      {
          return SessionFactory.GetCurrentSession();
      }
  </code></pre>
  
  <p>and the config file is </p>
  
  <pre><code>&lt;session-factory&gt;
  &lt;property name="connection.provider"&gt;NHibernate.Connection.DriverConnectionProvider&lt;/property&gt;
  &lt;property name="dialect"&gt;NHibernate.Dialect.MsSql2008Dialect&lt;/property&gt;
  &lt;property name="connection.driver_class"&gt;NHibernate.Driver.SqlClientDriver&lt;/property&gt;
  &lt;property name="connection.connection_string"&gt;Server=(local);initial catalog=NhibernateTest;Integrated Security=SSPI&lt;/property&gt;
  &lt;property name="proxyfactory.factory_class"&gt;NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle&lt;/property&gt;
  &lt;property name ="current_session_context_class"&gt;thread_static&lt;/property&gt;
  &lt;property name="cache.use_query_cache" &gt;true&lt;/property&gt;
  &lt;property name="show_sql"&gt;true&lt;/property&gt;
  </code></pre>
  
  <p></p>
  
  <p>and everytime I call GetBookByName method, it hits the database no matter what? Thanks</p>