title: Migration from Spring 2.5 to 4
body: <p>I want to migrate my project from Spring 2.5 to Spring 4.1<br>
  The old versions of Spring and Hibernate jars used in my project are:</p>
  
  <p>spring 2.5.6<br>
  spring-webmvc 2.5.6<br>
  spring-webflow 2.0.7.RELEASE<br>
  hibernate-annotations 3.4.0.GA<br>
  hibernate-commons-annotations 3.1.0.GA<br>
  hibernate-core 3.3.1.GA<br>
  hibernate ejb3-persistence 1.0.2.GA</p>
  
  <p>I wanted to know if there is a way I could find the latest version of Hibernate which is compatible with Spring ie 4.1<br>
  Secondly I would like to know what configuration changes should I make in applicationContext.xml.
  My applicationContext looks like this</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;beans xmlns="http://www.springframework.org/schema/beans"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xmlns:p="http://www.springframework.org/schema/p"
         xmlns:aop="http://www.springframework.org/schema/aop"
         xmlns:tx="http://www.springframework.org/schema/tx"
         xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
         http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
         http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd"&gt;
  
    &lt;bean id="propertyConfigurer"
            class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"&gt;
            &lt;property name="location" value="classpath:jdbc.properties"/&gt;
            &lt;property name="ignoreUnresolvablePlaceholders" value="true"/&gt;
     &lt;/bean&gt;   
  
      &lt;bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"&gt;
          &lt;property name="driverClassName" value="${dataSource.driverClassName}"&gt;&lt;/property&gt;
          &lt;property name="url" value="${dataSource.url}"&gt;&lt;/property&gt;
          &lt;property name="username" value="${dataSource.username}"&gt;&lt;/property&gt;
          &lt;property name="password" value="${dataSource.password}"&gt;&lt;/property&gt;
          &lt;property name="initialSize" value="1"&gt;&lt;/property&gt;
          &lt;property name="maxActive" value="10"&gt;&lt;/property&gt;
          &lt;property name="maxIdle" value="14"&gt;&lt;/property&gt;
          &lt;property name="minIdle" value="2"&gt;&lt;/property&gt;
          &lt;property name="maxWait" value="15000"&gt;&lt;/property&gt;
          &lt;property name="validationQuery" value="SELECT 1"&gt;&lt;/property&gt;
          &lt;property name="minEvictableIdleTimeMillis" value="5000"&gt;&lt;/property&gt;
          &lt;property name="testOnBorrow" value="true"&gt;&lt;/property&gt;
          &lt;property name="testOnReturn" value="true"&gt;&lt;/property&gt;
          &lt;property name="removeAbandoned" value="true"&gt;&lt;/property&gt;
          &lt;property name="removeAbandonedTimeout" value="5"&gt;&lt;/property&gt;
      &lt;/bean&gt;
  
    &lt;bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver"&gt;
          &lt;!-- Limit uploads to small (5KB) files for this sample --&gt;
          &lt;property name="maxUploadSize" value="809000" /&gt;
    &lt;/bean&gt;
  
      &lt;!-- Default Connection --&gt;
      &lt;bean id="sessionFactory"
          class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean"&gt;
          &lt;property name="dataSource" ref="dataSource" /&gt;
          &lt;property name="configLocation"&gt;
              &lt;value&gt;/WEB-INF/hibernate.cfg.xml&lt;/value&gt;
          &lt;/property&gt;
          &lt;property name="hibernateProperties"&gt;
              &lt;props&gt;
                  &lt;prop key="hibernate.dialect"&gt;${dataSource.dialect}&lt;/prop&gt;
                  &lt;prop key="hibernate.default_batch_fetch_size"&gt;30&lt;/prop&gt;
                  &lt;prop key="hibernate.jdbc.fetch_size"&gt;20&lt;/prop&gt;
                  &lt;prop key="org.hibernate.cache"&gt;info&lt;/prop&gt;
                  &lt;prop key="org.hibernate.transaction"&gt;debug&lt;/prop&gt;
                  &lt;prop key="hibernate.jdbc.batch_size"&gt;100&lt;/prop&gt;
                  &lt;prop key="hibernate.show_sql"&gt;false&lt;/prop&gt;
                  &lt;prop key="hibernate.use_sql_comments"&gt;true&lt;/prop&gt;
                  &lt;prop key="hibernate.max_fetch_depth"&gt;3&lt;/prop&gt;
                  &lt;prop key="hibernate.jdbc.batch_versioned_data"&gt;true&lt;/prop&gt;
              &lt;/props&gt;
          &lt;/property&gt;
          &lt;property name="schemaUpdate" value="false" /&gt;
  
      &lt;/bean&gt;
  
    &lt;bean id="txManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"&gt;
          &lt;property name="sessionFactory" ref="sessionFactory" /&gt;
    &lt;/bean&gt;
  
    &lt;tx:annotation-driven transaction-manager="txManager"/&gt;
  
    &lt;bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate"&gt;
          &lt;property name="dataSource" ref="dataSource"/&gt;
    &lt;/bean&gt;
  
   &lt;bean id="baseService" abstract="true" lazy-init="true"&gt;
          &lt;property name="jdbcTemplate" ref="jdbcTemplate"/&gt;
          &lt;property name="dataSource" ref="dataSource"/&gt;
          &lt;property name="sessionFactory" ref="sessionFactory"/&gt;
  
    &lt;/bean&gt;
  &lt;/beans&gt;
  </code></pre>
  
  <p>and at last, I'm using HibernateTemplate for my queries. Can I continue using the same after migration.?   </p>
  
  <p>Many thanks for every tip in advance... </p>