实现包含了Hibernate与数据库的基本连接信息的配置方式有两种方式:
第一种是使用hibernate.properties文件作为配置文件。
第二种是使用hibernate.cfg.xml文件作为配置文件。
hibernate.cfg.xml 例子
<?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">
<!-- NOTE: For Hibernate Session Factory Use Only -->
<hibernate-configuration>
<session-factory>
<property name="hibernate.dialect">org.hibernate.dialect.Oracle9Dialect</property>
<property name="connection.pool_size">1</property>
<property name="show_sql">false</property>