一、jar包
最基础的hibernatejar包,以及数据库驱动的jar包
二、数据库
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>