<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<!-- 数据库连接信息 -->
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.connection.url">jdbc:mysql://localhost:3306/hibernate?createDatabaseIfNotExist=true</property>
<property name="hibernate.connection.username">root</property>
<property name="hibernate.connection.password">liu123</property>
<!-- 数据库方言 -->
<property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
<!-- 配置是否显示Hibernate生成的SQL语句 -->
<property name="show_sql">true</property>
<!-- 配置自动根据映射文件更新数据表 -->
<property name="hbm2ddl.auto">update</property>
<!-- 配置实体映射文件(或实体类) -->
<mapping resource="cn/com/xalead/hibernate/entity/User.hbm.xml"/>
</session-factory>
</hibernate-configuration>
hibernate.cfg.xml配置mysql数据库信息
最新推荐文章于 2021-02-06 22:06:20 发布