1 四種方式配置Configuration:
傳遞一個java.util.Properties給Configuration.setProperties();
放置hibernate.properties在classpath路徑下;
設(shè)置System屬性,java -D property=value;
在hibernate.cfg.xml放置<property>元素。





2 獲取SessionFactory:如果有多個database, 可以獲取多個。


3 JDBC connections

為了獲取connection,我們需要傳遞一些屬性給Hiberante,以下的屬性定義在org.hibernate.cfg.Environment.
Hibernate通過java.sql.DriverManager獲取connection.
這些屬性包括:
hibernate.connection.driver_class
hibernate.connection.url
hibernate.connection.username
hibernate.connection.password
hibernate.connection.pool_size
Hibernate Datasource 屬性:
hibernate.connection.datasource
hibernate.jndi.url
hibernate.jndi.class
hibernate.connection.username
hibernate.connection.password
4 可選擇的hibernate 屬性
hibernate.dialect: 常用的有:org.hibernate.dialect.MySQLDialect, OracleDialect,Oracle9Dialect,SQLServerDialect
hibernate.show_sql
...
5 Hibernate 日志
Hibernate使用Apache commons-logging.
6 XML配置文件
...
<hibernate-configuration>
<session-factory name"">
<property>
...
</session-factory>
</hibernate-configuration>


