title: Spring 3.1.1 with hibernate 4.1 annotations configuration
body: <p>I am setting up the new project with spring3.1.1 and hibernate 4.1.
  When I run my project I am getting the following error</p>
  <pre><code>java.lang.NoSuchMethodError: org.hibernate.SessionFactory.getCurrentSession()Lorg/hibernate/classic/Session;
  at com.humancapital.dao.TestModelDAOImpl.getTestModelList(TestModelDAOImpl.java:22)
  </code></pre>
  <p>My applicationContext.xml</p>
  <pre><code> &lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
  
         
          &lt;context:component-scan base-package=&quot;com.example&quot;/&gt;
                                        
          &lt;!-- Use @Transaction annotations for managing transactions  --&gt;    
          &lt;tx:annotation-driven transaction-manager=&quot;transactionManager&quot;/&gt;
                                        
          &lt;!-- PropertyConfiguer --&gt;
          &lt;bean id=&quot;propertyCongigurer&quot; class=&quot;org.springframework.beans.factory.config.PropertyPlaceholderConfigurer&quot;&gt;
              &lt;property name=&quot;location&quot; value=&quot;/WEB-INF/config/jdbc/jdbc.properties&quot;&gt;&lt;/property&gt;
          &lt;/bean&gt;
          
          &lt;!--  DataSource connection --&gt;
          &lt;bean id=&quot;myDataSource&quot; class=&quot;org.springframework.jdbc.datasource.DriverManagerDataSource&quot;&gt;
              &lt;property name=&quot;driverClassName&quot; value=&quot;${jdbc.driverClassName}&quot;&gt;&lt;/property&gt;
              &lt;property name=&quot;url&quot; value=&quot;${jdbc.url}&quot;&gt;&lt;/property&gt;
              &lt;property name=&quot;username&quot; value=&quot;${jdbc.username}&quot;&gt;&lt;/property&gt;
              &lt;property name=&quot;password&quot; value=&quot;${jdbc.password}&quot;&gt;&lt;/property&gt;  
          &lt;/bean&gt;
          
          &lt;!-- Hibernate SessionFactory --&gt;
          &lt;bean id=&quot;sessionFactory&quot; class=&quot;org.springframework.orm.hibernate4.LocalSessionFactoryBean&quot;&gt;
              &lt;property name=&quot;dataSource&quot; ref=&quot;myDataSource&quot;&gt;&lt;/property&gt;
              &lt;property name=&quot;annotatedClasses&quot;&gt;
                  &lt;list&gt;
                      &lt;value&gt;com.humancapital.dao.TestModel&lt;/value&gt;
                  &lt;/list&gt;
              &lt;/property&gt;
              &lt;property name=&quot;hibernateProperties&quot;&gt;
              &lt;props&gt;
                  &lt;prop key=&quot;hibernate.dialect&quot;&gt;org.hibernate.dialect.MySQLDialect&lt;/prop&gt;
                  &lt;prop key=&quot;hibernate.show_sql&quot;&gt;true&lt;/prop&gt;
                  &lt;prop key=&quot;hibernate.hbm2ddl.auto&quot;&gt;update&lt;/prop&gt; 
              &lt;/props&gt;
              &lt;/property&gt;
          &lt;/bean&gt;
          
  
          
          &lt;bean id=&quot;transactionManager&quot; class=&quot;org.springframework.orm.hibernate4.HibernateTransactionManager&quot;&gt;
              &lt;property name=&quot;sessionFactory&quot; ref=&quot;sessionFactory&quot;&gt;&lt;/property&gt;
          &lt;/bean&gt;
          
          &lt;context:annotation-config/&gt;
          
          &lt;bean id=&quot;testModelDAO&quot; class=&quot;com.example.dao.TestModelDAOImpl&quot;&gt;&lt;/bean&gt;
  </code></pre>
  
  <h2>MyDAOImpl</h2>
  <pre><code>@Repository
  public class TestModelDAOImpl implements TestModelDAO {
  
  @Autowired
  private SessionFactory sessionFactory;
  public void setSessionFactory(SessionFactory sessionFactory){
      this.sessionFactory = sessionFactory;
  }
  
  @SuppressWarnings(&quot;rawtypes&quot;)
  @Override
      @Transactional(readOnly=true,propagation=Propagation.REQUIRES_NEW)
  public List getTestModelList() {
      System.out.println(sessionFactory.toString());
      return sessionFactory.getCurrentSession().createCriteria(TestModel.class).list();
  }
  }
  </code></pre>
  <p>I have added my dependency jars please suggest me</p>
  <pre><code>antlr-2.7.7.jar
  antlr-runtime-3.0.jar
  commons-collections-3.2.1.jar
  commons-dbcp-1.4.jar
  commons-fileupload-1.2.jar
  commons-lang-2.4.jar
  commons-logging.jar
  commons-pool-1.5.4.jar
  dom4j-1.6.1.jar
  ejb3-persistence-3.3.1.jar
  hibernate-commons-annotations-4.0.1.Final.jar
  hibernate-core-4.1.1.Final.jar
  hibernate-entitymanager-4.1.1.Final.jar
  hibernate-jpa-2.0-api-1.0.1.Final.jar
  hibernate-validator-4.0.2.GA.jar
  jackson-core-asl-1.9.2.jar
  jackson-jaxrs-1.8.5.jar
  jackson-mapper-asl-1.9.2.jar
  javassist-3.15.0-GA.jar
  jboss-logging-3.1.0.CR2.jar
  jboss-transaction-api_1.1_spec-1.0.0.Final.jar
  json-lib-2.3-jdk13.jar
  jstl-1.2.jar
  jta-1.1.jar
  log4j-1.2.14.jar
  mail.jar
  mysql-connector-java-5.0.8-bin.jar
  org.springframework.aop-3.1.1.RELEASE.jar
  org.springframework.asm-3.1.1.RELEASE.jar
  org.springframework.aspects-3.1.1.RELEASE.jar
  org.springframework.beans-3.1.1.RELEASE.jar
  org.springframework.context.support-3.1.1.RELEASE.jar
  org.springframework.context-3.1.1.RELEASE.jar
  org.springframework.core-3.1.1.RELEASE.jar
  org.springframework.expression-3.1.1.RELEASE.jar
  org.springframework.jdbc-3.1.1.RELEASE.jar
  org.springframework.jms-3.1.1.RELEASE.jar
  org.springframework.js-2.0.8.RELEASE.jar
  org.springframework.orm-3.1.1.RELEASE.jar
  org.springframework.oxm-3.1.1.RELEASE.jar
  org.springframework.test-3.1.1.RELEASE.jar
  org.springframework.transaction-3.1.1.RELEASE.jar
  org.springframework.web.servlet-3.1.1.RELEASE.jar
  org.springframework.web-3.1.1.RELEASE.jar
  servlet-api.jar
  slf4j-api-1.6.1.jar
  slf4j-log4j12-1.6.1.jar
  slf4j-simple-1.6.1.jar
  spring-modules-validation-0.7.jar
  standard.jar
  </code></pre>
  <p>Please Help me to complete the project setup.
  Please give some suggestion where we need to concentrate while setting up the new project structure where fewer changes are necessary for future up gradation.</p>
  <p>Sorry I am new to stackoverflow I don’t know how to give replay to the commands</p>