title: Cannot instantiate bean org.springframework.orm.hibernate5.LocalSessionFactoryBean
body: <p>Unable to initialize the Spring container. I am seeing the following error
  Note:  I have both javax.persistence-api-2.2.jar, persistence-api-1.0.2.jar in my classpath. I have struggled to understand, which one should i use in my project. Mine is a simple Spring app deployed to Tomcat. Please see comments below.</p>
  
  <blockquote>
    <p>Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: org.hibernate.engine.spi.SessionFactoryImplementor.getProperties()Ljava/util/Map;
           at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1778)
           at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:593)</p>
  </blockquote>
  
  <p>My goal is to instantiate this bean and move forward in my migration. I googled a lot and couldn't find a satisfying answer. I looked at the source code of Spring's LocalSessionFactoryBean also. </p>
  
  <p>Should i set hibernateProperties as a Map instead of Properties?</p>
  
  <p>I am using Spring 5.1.8, Hibernate 5.3.10.FINAL, Java 8 with Postgres database. I am actually migrating from Spring 1.2, hibernate 3.</p>
  
  <pre><code>&lt;bean id="sessionFactoryassets" class="org.springframework.orm.hibernate5.LocalSessionFactoryBean" destroy-method="destroy"&gt;
      &lt;property name="dataSource"&gt;
        &lt;ref bean="dataSourceassets" /&gt;
      &lt;/property&gt;
      &lt;property name="mappingResources" value="/com/startup/core/persistence/assets/ObjectMappings.xml" /&gt;
      &lt;property name="hibernateProperties"&gt;
        &lt;props&gt;
          &lt;prop key="hibernate.dialect"&gt;org.hibernate.dialect.PostgreSQLDialect&lt;/prop&gt;
          &lt;prop key="hibernate.cache.provider_class"&gt;org.hibernate.cache.NoCacheProvider&lt;/prop&gt;
        &lt;/props&gt;
      &lt;/property&gt;
    &lt;/bean&gt;
  </code></pre>