title: Hibernate session is not initialized at startup
body: <p>I use hibernate templates with spring (DB2, C3P0)</p>
  
  <p>application starts but connection is not opened.
  After first query from client c3p0 init kicks in and actually open the connection. But that takes 2-3 seconds whitch noticable slows down first client during its own startup.</p>
  
  <p>How to force hibernate to open db at startup?</p>
  
  <p>Code [EDIT]</p>
  
  <pre><code>  &lt;bean id=hibernateproperties &gt;
  &lt;property name="properties"&gt;
      &lt;props&gt;
       &lt;prop key="hibernate hbm2ddl|dialect|query.substitutions|show_sql &lt;/prop&gt;
       &lt;prop key="hibernate.c3po.minPoolSize"&gt;1&lt;/prop&gt;
       &lt;prop key="hibernate.c3po.maxPoolsize"&gt;5&lt;/prop&gt;
       &lt;prop key="hibernate.c3po.timeout"&gt;500&lt;/prop&gt;
       &lt;prop key="hibernate.c3po.max_statements"&gt;50&lt;/prop&gt;
       &lt;prop key="hibernate.c3po.testconnectionOnCheckout"&gt;true&lt;/prop&gt;
       &lt;prop key="hibernate.c3po.minActive"&gt;1&lt;/prop&gt;
  &lt;/property&gt;
  &lt;/bean&gt;
  &lt;bean id=sessionfactory 
      class=AnnotationSessionFactory 
      properties=hibernateproperties 
      dataSource=c3p0dataSource&gt;
      &lt;property name="packagesToScan" &gt;
          &lt;list&gt;
              &lt;value&gt;myPackages&lt;/value&gt;
          &lt;/list&gt;
      &lt;/property&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p>In log there is no initialization of c3p0 Until I manually create query. </p>
  
  <p>[EDIT]
  I debug code and when SessionFactory.getSession() is called it will findout that session is not created at all and initialize session with c3p0. Before actual query  there is log line
  Initializing c3p0 pool (with class and options).
  My guess that AnnotationSessionFactory use lazy approach to session init. </p>
  
  <p>NOTE:
  I set spring lazy bean init to false</p>