hibernate课程 初探单表映射1-7 hibernate配置文件新建

hibernate  配置文件新建

1    右键src==>new==》other==>hibernate configuration File==>next==>next==>finish

2    填写配置文件:dialect    mysql 方言  ;  hbm2ddl.auto ddl生成策略      ;

文件模板如下:

配置文件:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
  "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
  "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
    <session-factory>
     <property name="connection.driver_class">com.mysql.jdbc.Driver</property>
     <property name="connection.url">jdbc:mysql://localhost:3306/bendi</property>
     <property name="connection.username">root</property>
     <property name="connection.password">weidou318</property>
     <property name="dialect">org.hibernate.dialect.MySQLDialect</property>
     
     <property name="show_sql">true</property>
     <property name="format_sql">true</property>
     <property name="hbm2ddl.auto">create</property>
  
  <mapping resource = "Student.hbm.xml"/>     
    </session-factory>
</hibernate-configuration>

原文地址:https://www.cnblogs.com/1446358788-qq/p/8066826.html