title: Inactive sessions left open by NHibernate
body: <p>I am using Nhibernate to connect to an Oracle 11g database. The database administrator has asked me to have a look at the program as there are lots of inactive sessions being left open, and apparently this will soon crash the server.</p>
  
  <p>Why is Nhibernate not closing the connections? Here is an example of the code:</p>
  
  <pre><code>public void Foo()
  {
      using (_sessionFactory = _Configuration.BuildSessionFactory())
      using (_session = _sessionFactory.OpenSession())
      {
          _session.Transaction.Begin();
          //DO STUFF
          _session.Transcation.Commit();
      }
  }
  </code></pre>
  
  <p>I was under the impression that disposing of the session and sessionFactory, would call session.Close() and the connection would be closed.</p>
  
  <p>Is this just the connection pooling doing it's job? If so is there a way in which I can set a maximum size for the connection pool? Idealy in fluent Nhibernate?</p>