一、jar包

  最基础的hibernatejar包,以及数据库驱动的jar包

  hibernate搭建及其增删改查

二、数据库

1  t_user表
2      id  int  主键  自动增长
3      name varchar(20)

三、配置文件

 1 <?xml version="1.0" encoding="UTF-8"?>
 2 <!DOCTYPE hibernate-configuration PUBLIC
 3     "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
 4     "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
 5 <hibernate-configuration>
 6     <session-factory>
 7         <!--  配置数据库信息 -->
 8         <property name="hibernate.connection.username">root</property>
 9         <property name="hibernate.connection.password">mysql123</property>
10         <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
11         <property name="hibernate.connection.url">jdbc:mysql://localhost:3306/hibernate_test</property>
12         <property name="hibernate.connection.autocommit">true</property>
13         
14         <property name="hibernate.dialect">org.hibernate.dialect.MySQL5Dialect</property>
15         <property name="hibernate.hbm2ddl.auto">update</property>
16         <!-- 显示生成的sql语句 -->
17         <property name="hibernate.show_sql">true</property>
18         
19         <mapping resource="cn/itcast/domain/User.hbm.xml"/>
20     </session-factory>
21 </hibernate-configuration>
hibernate.cfg.xml

相关文章:

  • 2022-01-17
  • 2021-06-24
  • 2021-09-27
  • 2021-09-08
  • 2021-12-12
  • 2022-12-23
  • 2021-08-31
猜你喜欢
  • 2021-09-01
  • 2021-06-08
  • 2021-11-14
  • 2021-08-04
  • 2021-06-27
  • 2022-12-23
  • 2021-07-12
相关资源
相似解决方案