title: Spring and Hibernate: can I get rid of hibernate.cfg.xml and rely on annotation alone?
body: <p>I am using spring and hibernate together. In my application context, I have this section:</p>
  
  <pre><code>&lt;bean id="sessionFactory"
          class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"&gt;
          &lt;property name="dataSource" ref="dataSource" /&gt;
          &lt;property name="configLocation"&gt;
              &lt;value&gt;classpath:hibernate.cfg.xml&lt;/value&gt;
          &lt;/property&gt;
          &lt;property name="configurationClass"&gt;
              &lt;value&gt;org.hibernate.cfg.AnnotationConfiguration
              &lt;/value&gt;
          &lt;/property&gt;
  </code></pre>
  
  <p>The hibernate.cfg.xml only contains a list of classes we want hibernate to manage persistence. </p>
  
  <p>I wonder if I can replace this file totally? Can we simply rely on annotation alone to discover the list of classes that needs ORM? </p>
  
  <p>If it is possible in spring, then how?</p>