Attempt to go to sleep mode 5.2.9 from 4.3.11 . The hibernate genus api is currently used. After adding the dependencies to pom.xml, I get the following error while running tests of my modules:
Unsatisfied dependency expressed through the "sessionFactory" field; The nested exception is org.springframework.beans.factory.BeanCreationException: An error occurred while creating a bean with the name "sessionFactory" defined in the key path resource [testApplicationContext.xml]: the init method call failed; The nested exception is org.hibernate.loader.MultipleBagFetchException: cannot retrieve multiple packages at the same time
I have testApplicationContext.xml with the following:
<bean id="sessionFactory" class="org.springframework.orm.hibernate5.LocalSessionFactoryBean"> <property name="dataSource" ref="dataSource"/> <property name="packagesToScan" value="org.xxxx.xxxx.xxxx.model"/> <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">true</prop> <prop key="hibernate.use_sql_comments">true</prop> <prop key="hibernate.hbm2ddl.auto">update</prop> </props> </property> </bean> <bean id="transactionManager" class="org.springframework.orm.hibernate5.HibernateTransactionManager"> <property name="sessionFactory" ref="sessionFactory" /> </bean> <tx:annotation-driven transaction-manager="transactionManager" />
I updated sessionFactory and transactionManager from hibernate4 to hibernate5.
pom.xml
<dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-core</artifactId> <version>5.2.9.Final</version> </dependency>
As far as I can tell, the error message implies that there is a problem loading multiple downloaded collections. However, I understand from this that the use of hibernation annotations and newer versions of hibernate support this use case.
Can anyone help? thanks
spring hibernate
Hurricane
source share