【发布时间】:2017-06-14 16:21:56
【问题描述】:
目前我正在将我的 bean 创建和配置设置从基于 XML 移动到基于 JAVA 的 spring 配置。我坚持移动数据库设置?如何在基于 JAVA 的配置文件中编写这些休眠数据库设置?
<bean
class="org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor" />
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<property name="hibernateProperties">
<value>
hibernate.connection.driver_class=com.mysql.jdbc.Driver
hibernate.connection.url=jdbc:mysql://url
hibernate.connection.username=username
hibernate.connection.password=password
hibernate.dialect=org.hibernate.dialect.HSQLDialect
hibernate.show_sql=false
</value>
</property>
<property name="packagesToScan" value="com.test" />
</bean>
<tx:annotation-driven />
<bean id="transactionManager"
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory" />
</bean>
<tx:annotation-driven proxy-target-class="true" />
我已添加交易详情。我得到了这个例外:
引起:java.lang.ClassNotFoundException: org.hibernate.context.spi.CurrentSessionContext
【问题讨论】:
标签: java spring spring-boot hibernate orm