[SOLVED] Hibernate 6 class using unimplemented "integrator#integrate" method? Can't start hibernate

Hello,
I’m upgrading from version 4 to version 6.0.2.
I’m also uptrading to Spring last version (6.0.12).

All went good with the code, some lines/import to change, but nothing that breaks a class.
But, when, starting tomcat, I got the following error.
I then updated my config to stop using deprecated classes (I thought the deprecated classes where executing the “integrate” method), but the error is still exactly the SAME. I don’t know what to do

EDIT: my dependencies are using old hibernate version trying to safely remove them and see if it works

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactoryStock' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: [PersistenceUnit: hibernate] Unable to build Hibernate SessionFactory; nested exception is java.lang.UnsupportedOperationException: Call to un-implemented deprecated legacy `Integrator#integrate` overload form
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1770) ~[spring-beans-6.0.12.jar:6.0.12]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:598) ~[spring-beans-6.0.12.jar:6.0.12]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:520) ~[spring-beans-6.0.12.jar:6.0.12]
        at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:325) ~[spring-beans-6.0.12.jar:6.0.12]
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-6.0.12.jar:6.0.12]
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:323) ~[spring-beans-6.0.12.jar:6.0.12]
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-6.0.12.jar:6.0.12]
        at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1158) ~[spring-context-6.0.12.jar:6.0.12]
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:932) ~[spring-context-6.0.12.jar:6.0.12]
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:608) ~[spring-context-6.0.12.jar:6.0.12]
        at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:394) ~[spring-web-6.0.12.jar:6.0.12]
        at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:274) ~[spring-web-6.0.12.jar:6.0.12]
        at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:102) ~[spring-web-6.0.12.jar:6.0.12]
        at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4422) ~[catalina.jar:10.1.13]
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:4860) ~[catalina.jar:10.1.13]
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:171) ~[catalina.jar:10.1.13]
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:683) ~[catalina.jar:10.1.13]
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:658) ~[catalina.jar:10.1.13]
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:713) ~[catalina.jar:10.1.13]
        at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:975) ~[catalina.jar:10.1.13]
        at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1949) ~[catalina.jar:10.1.13]
        at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) ~[na:na]
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[na:na]
        at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75) ~[tomcat-util.jar:10.1.13]
        at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:123) ~[na:na]
        at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:776) ~[catalina.jar:10.1.13]
        at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:426) ~[catalina.jar:10.1.13]
        at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1656) ~[catalina.jar:10.1.13]
        at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:309) ~[catalina.jar:10.1.13]
        at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:114) ~[catalina.jar:10.1.13]
        at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:402) ~[catalina.jar:10.1.13]
        at org.apache.catalina.util.LifecycleBase.setState(LifecycleBase.java:345) ~[catalina.jar:10.1.13]
        at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:893) ~[catalina.jar:10.1.13]
        at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:846) ~[catalina.jar:10.1.13]
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:171) ~[catalina.jar:10.1.13]
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1332) ~[catalina.jar:10.1.13]
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1322) ~[catalina.jar:10.1.13]
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[na:na]
        at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75) ~[tomcat-util.jar:10.1.13]
        at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:145) ~[na:na]
        at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:866) ~[catalina.jar:10.1.13]
        at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:241) ~[catalina.jar:10.1.13]
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:171) ~[catalina.jar:10.1.13]
        at org.apache.catalina.core.StandardService.startInternal(StandardService.java:433) ~[catalina.jar:10.1.13]
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:171) ~[catalina.jar:10.1.13]
        at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:918) ~[catalina.jar:10.1.13]
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:171) ~[catalina.jar:10.1.13]
        at org.apache.catalina.startup.Catalina.start(Catalina.java:795) ~[catalina.jar:10.1.13]
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[na:na]
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
        at java.base/java.lang.reflect.Method.invoke(Method.java:568) ~[na:na]
        at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:347) ~[bootstrap.jar:10.1.13]
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:478) ~[bootstrap.jar:10.1.13]
Caused by: jakarta.persistence.PersistenceException: [PersistenceUnit: hibernate] Unable to build Hibernate SessionFactory; nested exception is java.lang.UnsupportedOperationException: Call to un-implemented deprecated legacy `Integrator#integrate` overload form
        at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:421) ~[spring-orm-6.0.12.jar:6.0.12]
        at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:396) ~[spring-orm-6.0.12.jar:6.0.12]
        at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.afterPropertiesSet(LocalContainerEntityManagerFactoryBean.java:352) ~[spring-orm-6.0.12.jar:6.0.12]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1817) ~[spring-beans-6.0.12.jar:6.0.12]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1766) ~[spring-beans-6.0.12.jar:6.0.12]
        ... 53 common frames omitted
Caused by: java.lang.UnsupportedOperationException: Call to un-implemented deprecated legacy `Integrator#integrate` overload form
        at org.hibernate.integrator.spi.Integrator.integrate(Integrator.java:39) ~[hibernate-core-6.0.2.Final.jar:6.0.2.Final]
        at org.hibernate.integrator.spi.Integrator.integrate(Integrator.java:57) ~[hibernate-core-6.0.2.Final.jar:6.0.2.Final]
        at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:284) ~[hibernate-core-6.0.2.Final.jar:6.0.2.Final]
        at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:415) ~[hibernate-core-6.0.2.Final.jar:6.0.2.Final]
        at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:1425) ~[hibernate-core-6.0.2.Final.jar:6.0.2.Final]
        at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:75) ~[spring-orm-6.0.12.jar:6.0.12]
        at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:376) ~[spring-orm-6.0.12.jar:6.0.12]
        at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:409) ~[spring-orm-6.0.12.jar:6.0.12]
        ... 57 common frames omitted

I updated the config from this:

   <context:component-scan base-package="fr.si2m.dsn.service" />
    <context:component-scan base-package="fr.si2m.dsn.dao" />
    <context:component-scan base-package="fr.si2m.dsn.bean" />
    <context:component-scan base-package="fr.si2m.dsn.bean.anomalies" />
    <context:component-scan base-package="fr.si2m.dsn.config" />
    <context:component-scan base-package="fr.si2m.dsn.delegataire" />
	<context:component-scan base-package="fr.si2m.dsn.amorcage" /> <!-- Fonctions "Fiches de paramétrage" du lot 6 -->
	<context:component-scan base-package="fr.si2m.dsn.fiches" />   <!-- Fonctions "Fiches de paramétrage" du lot 7 (DEV en cours) -->
	<context:component-scan base-package="fr.si2m.dsn.gestionnaire" />
	<context:component-scan base-package="fr.si2m.dsn.validator" />
	<context:component-scan base-package="fr.si2m.dsn.extraction" />

 	<bean id="dataSourceStock" name="dataSourceStock" class="org.apache.commons.dbcp2.BasicDataSource">
        <property name="driverClassName" value="${jdbc.driverClassName}" />
        <property name="url" value="jdbc:mysql://#{ T(java.lang.System).getenv('${jdbc.dbHost}')}:#{ T(java.lang.System).getenv('${jdbc.dbPort}')}/#{ T(java.lang.System).getenv('${jdbc.stock.dbName}')}?autoReconnect=true"/>
        <property name="username" value="#{ T(java.lang.System).getenv('${jdbc.dbUser}')}" />
        <property name="password" value="#{ T(java.lang.System).getenv('${jdbc.dbPassword}')}"/>
        <property name="initialSize" value="1" />
        <property name="minIdle" value="1" />
        <property name="maxIdle" value="20" />
        <property name="maxTotal" value="30" />
        <property name="validationQuery" value="SELECT 1;" />
        <property name="testOnBorrow" value="true" />
        <property name="validationQueryTimeout" value="34000" />
        <property name="testOnReturn" value="true" />
        <property name="testWhileIdle" value="true" />
        <property name="timeBetweenEvictionRunsMillis" value="34000" />
        <property name="minEvictableIdleTimeMillis" value="55000" />
        <property name="removeAbandonedTimeout" value="100" />
        <property name="removeAbandonedOnBorrow" value="true" />
    </bean>

    <bean id="dataSourceVersion" name="dataSourceVersion" class="org.apache.commons.dbcp2.BasicDataSource">
        <property name="driverClassName" value="${jdbc.driverClassName}" />
        <property name="url" value="jdbc:mysql://#{ T(java.lang.System).getenv('${jdbc.dbHost}')}:#{ T(java.lang.System).getenv('${jdbc.dbPort}')}/#{ T(java.lang.System).getenv('${jdbc.version.dbName}')}?autoReconnect=true"/>
        <property name="username" value="#{ T(java.lang.System).getenv('${jdbc.dbUser}')}" />
        <property name="password" value="#{ T(java.lang.System).getenv('${jdbc.dbPassword}')}"/>
        <property name="initialSize" value="1" />
        <property name="minIdle" value="1" />
        <property name="maxIdle" value="20" />
        <property name="maxTotal" value="30" />
        <property name="validationQuery" value="SELECT 1;" />
        <property name="testOnBorrow" value="true" />
        <property name="validationQueryTimeout" value="34000" />
        <property name="testOnReturn" value="true" />
        <property name="testWhileIdle" value="true" />
        <property name="timeBetweenEvictionRunsMillis" value="34000" />
        <property name="minEvictableIdleTimeMillis" value="55000" />
        <property name="removeAbandonedTimeout" value="100" />
        <property name="removeAbandonedOnBorrow" value="true" />
    </bean>

    <bean id="sessionFactoryStock" name="sessionFactoryStock" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean" >
        <property name="dataSource" ref="dataSourceStock"/>
        <property name="packagesToScan">
        	<list>
				<value>fr.si2m.dsn.persistance.stock.donnee.p99v99</value>
        	</list>
        </property>
        <property name="hibernateProperties">
            <props>
                <prop key="hibernate.dialect">${hibernate.dialect}</prop>
                <prop key="hibernate.show_sql">${hibernate.show_sql}</prop>
                <prop key="hibernate.format_sql">${hibernate.format_sql}</prop>
                <prop key="javax.persistence.validation.mode">none</prop>
                <prop key="hibernate.default_batch_fetch_size">100</prop>
            </props>
        </property>
    </bean>

    <bean id="sessionFactoryVersion"  name="sessionFactoryVersion" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean" >
        <property name="dataSource" ref="dataSourceVersion"/>
        <property name="packagesToScan">
            <list>
				<value>fr.si2m.dsn.persistance.version.autogen.p3</value>
				<value>fr.si2m.ducsdsn.persistance.g3c.donnee</value>
				<value>fr.si2m.ducsdsn.persistance.donnee</value>
            </list>
        </property>
        <property name="hibernateProperties">
            <props>
                <prop key="hibernate.dialect">${hibernate.dialect}</prop>
                <prop key="hibernate.show_sql">${hibernate.show_sql}</prop>
                <prop key="hibernate.format_sql">${hibernate.format_sql}</prop>
                <prop key="javax.persistence.validation.mode">none</prop>
                <prop key="hibernate.default_batch_fetch_size">100</prop>
            </props>
        </property>
    </bean>

    <bean id="persistenceExceptionTranslationPostProcessor"
               class="org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor"/>

    <!-- Transaction Manager -->
    <bean id="transactionManagerStock" class="org.springframework.orm.hibernate4.HibernateTransactionManager">
        <property name="sessionFactory" ref="sessionFactoryStock" />
    </bean>

    <bean id="transactionManagerVersion" class="org.springframework.orm.hibernate4.HibernateTransactionManager">
        <property name="sessionFactory" ref="sessionFactoryVersion" />
    </bean>

    <!-- Detect @Transactional -->
    <tx:annotation-driven transaction-manager="transactionManagerStock" />
    <tx:annotation-driven transaction-manager="transactionManagerVersion" />


to this:

   <!-- Scan for all of Spring components such as Spring Service -->
    <context:component-scan base-package="fr.si2m.dsn.service" />
    <context:component-scan base-package="fr.si2m.dsn.dao" />
    <context:component-scan base-package="fr.si2m.dsn.bean" />
    <context:component-scan base-package="fr.si2m.dsn.bean.anomalies" />
    <context:component-scan base-package="fr.si2m.dsn.config" />
    <context:component-scan base-package="fr.si2m.dsn.delegataire" />
	<context:component-scan base-package="fr.si2m.dsn.amorcage" /> <!-- Fonctions "Fiches de paramétrage" du lot 6 -->
	<context:component-scan base-package="fr.si2m.dsn.fiches" />   <!-- Fonctions "Fiches de paramétrage" du lot 7 (DEV en cours) -->
	<context:component-scan base-package="fr.si2m.dsn.gestionnaire" />
	<context:component-scan base-package="fr.si2m.dsn.validator" />
	<context:component-scan base-package="fr.si2m.dsn.extraction" />

 	<bean id="dataSourceStock" name="dataSourceStock" class="org.apache.commons.dbcp2.BasicDataSource">
        <property name="driverClassName" value="${jdbc.driverClassName}" />
        <property name="url" value="jdbc:mysql://#{ T(java.lang.System).getenv('${jdbc.dbHost}')}:#{ T(java.lang.System).getenv('${jdbc.dbPort}')}/#{ T(java.lang.System).getenv('${jdbc.stock.dbName}')}?autoReconnect=true"/>
        <property name="username" value="#{ T(java.lang.System).getenv('${jdbc.dbUser}')}" />
        <property name="password" value="#{ T(java.lang.System).getenv('${jdbc.dbPassword}')}"/>
        <property name="initialSize" value="1" />
        <property name="minIdle" value="1" />
        <property name="maxIdle" value="20" />
        <property name="maxTotal" value="30" />
        <property name="validationQuery" value="SELECT 1;" />
        <property name="testOnBorrow" value="true" />
        <property name="validationQueryTimeout" value="34000" />
        <property name="testOnReturn" value="true" />
        <property name="testWhileIdle" value="true" />
        <property name="timeBetweenEvictionRunsMillis" value="34000" />
        <property name="minEvictableIdleTimeMillis" value="55000" />
        <property name="removeAbandonedTimeout" value="100" />
        <property name="removeAbandonedOnBorrow" value="true" />
    </bean>

    <bean id="dataSourceVersion" name="dataSourceVersion" class="org.apache.commons.dbcp2.BasicDataSource">
        <property name="driverClassName" value="${jdbc.driverClassName}" />
        <property name="url" value="jdbc:mysql://#{ T(java.lang.System).getenv('${jdbc.dbHost}')}:#{ T(java.lang.System).getenv('${jdbc.dbPort}')}/#{ T(java.lang.System).getenv('${jdbc.version.dbName}')}?autoReconnect=true"/>
        <property name="username" value="#{ T(java.lang.System).getenv('${jdbc.dbUser}')}" />
        <property name="password" value="#{ T(java.lang.System).getenv('${jdbc.dbPassword}')}"/>
        <property name="initialSize" value="1" />
        <property name="minIdle" value="1" />
        <property name="maxIdle" value="20" />
        <property name="maxTotal" value="30" />
        <property name="validationQuery" value="SELECT 1;" />
        <property name="testOnBorrow" value="true" />
        <property name="validationQueryTimeout" value="34000" />
        <property name="testOnReturn" value="true" />
        <property name="testWhileIdle" value="true" />
        <property name="timeBetweenEvictionRunsMillis" value="34000" />
        <property name="minEvictableIdleTimeMillis" value="55000" />
        <property name="removeAbandonedTimeout" value="100" />
        <property name="removeAbandonedOnBorrow" value="true" />
    </bean>

    <bean id="sessionFactoryStock" name="sessionFactoryStock" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean" >
        <property name="persistenceUnitName" value="hibernate"/>        
        <property name="persistenceXmlLocation" value="classpath:META-INF/persistence.xml"/>
        <property name="dataSource" ref="dataSourceStock"/>
        <property name="jpaVendorAdapter" ref="entityManagerFactory"/>    
        <property name="packagesToScan">
        	<list>
				<value>fr.si2m.dsn.persistance.stock.donnee.p99v99</value>
        	</list>
        </property>
        <property name="jpaPropertyMap">
            <props>
                <prop key="hibernate.dialect">${hibernate.dialect}</prop>
                <prop key="hibernate.show_sql">${hibernate.show_sql}</prop>
                <prop key="hibernate.format_sql">${hibernate.format_sql}</prop>
                <prop key="javax.persistence.validation.mode">none</prop>
                <prop key="hibernate.default_batch_fetch_size">100</prop>
            </props>
        </property>
    </bean>

    <bean id="sessionFactoryVersion"  name="sessionFactoryVersion" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean" >
        <property name="persistenceUnitName" value="hibernate"/>        
        <property name="persistenceXmlLocation" value="classpath:META-INF/persistence.xml"/>
        <property name="dataSource" ref="dataSourceVersion"/>
        <property name="jpaVendorAdapter" ref="entityManagerFactory"/>    
        <property name="packagesToScan">
            <list>
				<value>fr.si2m.dsn.persistance.version.autogen.p3</value>
				<value>fr.si2m.ducsdsn.persistance.g3c.donnee</value>
				<value>fr.si2m.ducsdsn.persistance.donnee</value>
            </list>
        </property>
        <property name="jpaPropertyMap">
            <props>
                <prop key="hibernate.dialect">${hibernate.dialect}</prop>
                <prop key="hibernate.show_sql">${hibernate.show_sql}</prop>
                <prop key="hibernate.format_sql">${hibernate.format_sql}</prop>
                <prop key="javax.persistence.validation.mode">none</prop>
                <prop key="hibernate.default_batch_fetch_size">100</prop>
            </props>
        </property>
    </bean>

        <bean id="entityManagerFactory" class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
                <property name="showSql" value="false" />
                <property name="database" value="MYSQL" />
    </bean>
<bean id="persistenceExceptionTranslationPostProcessor"
               class="org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor"/>

    <!-- Transaction Manager -->
    <bean id="transactionManagerStock" class="org.springframework.orm.jpa.JpaTransactionManager">
        <property name="sessionFactory" ref="sessionFactoryStock" />
    </bean>

    <bean id="transactionManagerVersion" class="org.springframework.orm.jpa.JpaTransactionManager">
        <property name="sessionFactory" ref="sessionFactoryVersion" />
    </bean>

    <!-- Detect @Transactional -->
    <tx:annotation-driven transaction-manager="transactionManagerStock" />
    <tx:annotation-driven transaction-manager="transactionManagerVersion" />

The problem is solved and came from the other hibernate version, imported by other dependencies

Dear,

I need spring annotation 6 and hibernate annotation 6 configure XML base tutorial.
my email account mdabrarulhasan@gmail.com

Thanks

Dear,

My problem

Spring 6+hibernate 6 configure

Dear,

Error.

org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [org.springframework.orm.hibernate6.LocalSessionFactoryBean] for bean with name ‘mySessionFactory’ defined in ServletContext resource [/WEB-INF/dwp-servlet.xml]

My code.

<!-- org.springframework.orm.hibernate6.LocalSessionFactoryBean -->
<!-- org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean -->

<bean id="mySessionFactory" class="org.springframework.orm.hibernate6.LocalSessionFactoryBean">
    <property name="dataSource" ref="myDataSource" />         
    	<property name="annotatedClasses">
            <list>
            	<value>project.bn.TestBn</value>   
            </list>
    	</property> 
    <property name="hibernateProperties">
        <props>
            <prop key="hibernate.dialect">org.hibernate.dialect.Oracle12cDialect</prop>                         
            <prop key="hibernate.jdbc.lob.non_contextual_creation">true</prop>  
            <!--<prop key="hibernate.id.new_generator_mappings">false</prop>-->  
            
            <prop key="hibernate.connection.CharSet">utf8</prop>
            <prop key="hibernate.connection.characterEncoding">utf8</prop>
            <prop key="hibernate.connection.useUnicode">true</prop>
                            
            <prop key="connection.pool_size">1</prop>
            <prop key="current_session_context_class">thread</prop>
                 
            <prop key="hibernate.show_sql">true</prop>
            <prop key="hibernate.hbm2ddl.auto">update</prop>                
        </props>
    </property>
</bean>
            
		    
<!-- TRANSACTION -->
<!-- org.springframework.orm.jpa.JpaTransactionManager -->

<tx:annotation-driven transaction-manager="transactionManager"/>	

<bean id="transactionManager" class="org.springframework.orm.hibernate6.LocalSessionFactoryBean">
    <property name="sessionFactory" ref="mySessionFactory" />
</bean>
               
            
<bean id="testBn" class="project.bn.TestBn"/>

<bean id="testDao" class="project.dao.TestDao">  
	<property name="sessionFactory" ref="mySessionFactory"></property>  
</bean>  

<bean id="testController" class="project.controller.TestController">
	<property name="testDao" ref="testDao" />  
</bean>

DAO class

@Autowired
private SessionFactory sessionFactory;

public SessionFactory getSessionFactory() {
	return sessionFactory;
}

public void setSessionFactory(SessionFactory sessionFactory) {
	this.sessionFactory = sessionFactory;
}

Error

org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘sessionFactory’ defined in ServletContext resource [/WEB-INF/sphbSix-servlet.xml]: org/hibernate/dialect/Oracle12cDialect

XML Mapping

 <bean id="sessionFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean" >     
	<property name="persistenceUnitName" value="hibernate"/>        
    <property name="persistenceXmlLocation" value="classpath:META-INF/persistence.xml"/>
    <property name="dataSource" ref="myDataSource"/>         
    <property name="jpaVendorAdapter" ref="entityManagerFactory"/>    
           
    <property name="packagesToScan">
        <list>
			<value>project.bn.Book</value>
        </list>
    </property>
    <property name="jpaPropertyMap">
        <props>
            <prop key="hibernate.dialect">org.hibernate.dialect.OracleDialect</prop>                      
            <prop key="hibernate.jdbc.lob.non_contextual_creation">true</prop>  
                     
            <prop key="hibernate.connection.CharSet">utf8</prop>
            <prop key="hibernate.connection.characterEncoding">utf8</prop>
            <prop key="hibernate.connection.useUnicode">true</prop>
                            
            <prop key="connection.pool_size">1</prop>
            <prop key="current_session_context_class">thread</prop>
                 
            <prop key="hibernate.show_sql">true</prop>
            <prop key="hibernate.hbm2ddl.auto">update</prop>                
        </props>
    </property>  
</bean>  

<bean id="entityManagerFactory" class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
            <property name="showSql" value="false" />
            <property name="database" value="ORACLE" />
</bean> 
                           
<bean id="transactionManager" class="org.springframework.transaction.jta.JpaTransactionManager">
    <property name="sessionFactory" ref="sessionFactory" />
</bean>                
            
<bean id="testBn" class="project.bn.TestBn"/>
<bean id="book" class="project.bn.Book"/>

<bean id="testDao" class="project.dao.TestDao">  
	<property name="sessionFactory" ref="sessionFactory" />
</bean>  

<bean id="testController" class="project.controller.TestController">
	<property name="testDao" ref="testDao" />  
</bean> 

DAO

@Autowired
private SessionFactory sessionFactory;

public SessionFactory getSessionFactory() {
	return sessionFactory;
}

public void setSessionFactory(SessionFactory sessionFactory) {
	this.sessionFactory = sessionFactory;
}

Stop posting unrelated messages on already solved topics. If you have a question, create a new topic and ask the question as well as provide some context. Posting a bunch of code snippets is not a question and if you don’t stop this annoying spam behavior, I will block you.