spring整合hibernate最基础的方式

1 创建文件,可以创建web文件
目录
spring整合hibernate最基础的方式_第1张图片
2 导入jar包,需要导全,我就是jar没导全,后面怎么运行都不对
3 配置applicationContext.xml


<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/aop
   http://www.springframework.org/schema/aop/spring-aop.xsd
   http://www.springframework.org/schema/tx 
   http://www.springframework.org/schema/tx/spring-tx.xsd">
  <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
	       
	      <property name="driverClassName" value="com.mysql.jdbc.Driver"/>
		  <property name="url" value="jdbc:mysql://localhost:3306/User?useSSL=false&useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2B8"/>
		   <property name="username" value="账号"/>
		    <property name="password" value="填自己的密码"/>
   bean>
	<bean id="sessionFactory"
		

你可能感兴趣的:(hibernate,spring,java)