title: hibernate.cfg.xml alternative in java file
body: <p>I am using spring framework and for database I am using hibernate.cfg.xml in the following way</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;!DOCTYPE hibernate-configuration PUBLIC
      "-//Hibernate/Hibernate Configuration DTD//EN"
      "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"&gt;
  &lt;hibernate-configuration&gt;
      &lt;session-factory&gt;
          &lt;property name="cache.provider_class"&gt;org.hibernate.cache.NoCacheProvider&lt;/property&gt;
          &lt;property name="show_sql"&gt;false&lt;/property&gt; 
          &lt;property name="hbm2ddl.auto"&gt;update&lt;/property&gt;
          &lt;mapping class="com.lynas.test.Student" /&gt;
      &lt;/session-factory&gt;
  &lt;/hibernate-configuration&gt;
  </code></pre>
  
  <p>Now is there any way to write this code in the java file. Like a bean or something??</p>