hibernate.cfg.xml文件配置标签详解

来源:互联网 发布:vb工控软件开发 编辑:程序博客网 时间:2024/05/17 19:22
<?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><!-- 一个sessionFactory代表数据库的一个连接 --><session-factory><!-- 链接数据库的用户名 --><property name="connection.username">root</property><!-- 链接数据库的密码 --><property name="connection.password">root</property><!-- 链接数据库的驱动 --><property name="connection.driver_class">com.mysql.jdbc.Driver</property><!-- 链接数据库的url --><property name="connection.url">jdbc:mysql://localhost:3306/itheima10_hibernate</property><!-- 方言告诉hibernate用什么样的数据库--><property name="dialect">org.hibernate.dialect.MySQLDialect</property><!-- validate 加载hibernate时,验证数据库的结构  默认值update  加载hibernate时,检查数据库,如果表不存在,则创建,如果存在,则更新create  每次加载hiberante,都会创建表create-drop  每次加载hiberante,创建,卸载hiberante时,销毁--><property name="hbm2ddl.auto">update</property><property name="show_sql">true</property><property name="format_sql">true</property><mapping resource="com/itheima10/hibernate/domain/Person.hbm.xml" /></session-factory></hibernate-configuration>