hibernate.cfg.xml配置

来源:互联网 发布:php资产管理系统源码 编辑:程序博客网 时间:2024/05/16 12:45
<?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="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
  <property name="hibernate.connection.url">jdbc:mysql:///poost</property>
  <property name="hibernate.connection.username">root</property>
  <property name="hibernate.connection.password">root</property>
     <!-- 自动选择连接数据库类型 -->
   <property name="dialect">org.hibernate.dialect.MySQLDialect</property>
   <!-- 显示sql语句 -->
   <property name="hibernate.show_sql">true</property>
   <!-- 格式化sql语句 -->
   <property name="hibernate.format_sql">true</property>
   <!-- 自动创建更新表结构 -->
   <property name="hibernate.hbm2ddl.auto">update</property>
  <mapping resource="com/bd/dao/Emp.hbm.xml"/>
  <mapping class="com.bd.model.Emp"/>
  </session-factory>
</hibernate-configuration>      
原创粉丝点击