技术栈:Spring4、Hibernate5、MySQL5.7
资源链接:https://pan.baidu.com/s/1xvUrU8Ul1mP_IK5JkSnYEg
提取码:3306
applicationContext.xml配置(因人而异,随缘抽取即可):
注意: LocalSessionFactoryBean 与 HibernateTransactionManager的版本前缀必须一致,否则会抛出版本不一致等一系列的异常。
bean id=“mySessionFactory” class=“org.springframework.orm.hibernate5.LocalSessionFactoryBean”
bean id=“transactionManager” class=“org.springframework.orm.hibernate5.HibernateTransactionManager”
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd
http: