hibernate配置模板
<?xml version='1.0' encoding='gb2312'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<!--顯示執(zhí)行的SQL語句-->
<property name="show_sql">true</property>
<!--連接字符串-->
<property name="connection.url">jdbc:mysql://localhost:3306/Test</property>
<!--連接數(shù)據(jù)庫的用戶名-->
<property name="connection.username">sa</property>
<!--數(shù)據(jù)庫用戶密碼-->
<property name="connection.password">sa</property>
<!--數(shù)據(jù)庫驅(qū)動-->
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
<!--JDBC連接池(使用內(nèi)置的連接池)-->
<property name="connection.pool_size">1</property>
<!--設(shè)置Hibernate自動管理上下文的策略-->
<property name="current_session_context_class">thread</property>
<!--選擇使用的方言-->
<property name="dialect">org.hibernate.dialect.MySQLDialect</property>
<!--在啟動時刪除并重新創(chuàng)建數(shù)據(jù)庫-->
<property name="hbm2ddl.auto">create</property>
<mapping resource="events/User.hbm.xml"/>
<mapping resource="events/Student.hbm.xml"/>
</session-factory>
</hibernate-configuration>
posted on 2011-04-28 18:25 jack zhai 閱讀(306) 評論(0) 編輯 收藏 所屬分類: hibernate