hibernate 的hibernate.cfg.xml标准配置文档

<?xml version="1.0" encoding="utf8"?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

<hibernate-configuration>
  <session-factory>
  <!-- JDBC的驱动程序 -->
    <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
  <!-- 数据库连接字符串 -->
    <property name="hibernate.connection.url">jdbc:mysql://localhost:3306/dwtj?useUnicode=true&amp;characterEncoding=gbk</property>
    <property name="hibernate.connection.username">root</property>
    <property name="hibernate.connection.password">000</property>
   <!-- SQL方言 -->
    <property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
    <!-- 是否使用二级缓存 -->
    <property name="hibernate.cache.use_second_level_cache">false</property>
    <property name="cache.use_query_cache">false</property>
    <property name="hibernate.show_sql">true</property>
    
    <property name="hibernate.hbm2ddl.auto">update</property>
    <property name="connection.autocommit">true</property>
    
    <!-- 映射文件 -->
    <mapping resource="com/dwtj/model/Messages.hbm.xml"/>
    <mapping resource="com/dwtj/model/Products.hbm.xml"/>
    <mapping resource="com/dwtj/model/Users.hbm.xml"/>
    <mapping resource="com/dwtj/model/PrenticeMsg.hbm.xml"/>
    <mapping resource="com/dwtj/model/Student.hbm.xml"/>
    <mapping resource="com/dwtj/model/ReplyMsg.hbm.xml"/>
    <mapping resource="com/dwtj/model/SystemLogs.hbm.xml"/>
    <mapping resource="com/dwtj/model/Images.hbm.xml"/>
    <mapping resource="com/dwtj/model/Role.hbm.xml"/>
    <mapping resource="com/dwtj/model/FriendLink.hbm.xml"/>
    <mapping resource="com/dwtj/model/Questions.hbm.xml"/>
    <mapping resource="com/dwtj/model/Answers.hbm.xml"/>
  </session-factory>
</hibernate-configuration>

你可能感兴趣的:(Hibernate)