日期:2014-05-16  浏览次数:20459 次

Hibernate加载其数据库配置

?Hibernate加载其配置文件hibernate.properties和hibernate.cfg.xml,常用xml文件比较直观,方便管理, Hibernate 是一个流行的开源对象关系映射工具,方便连接不同数据库,更换数据库,只要修改Hibernate配置文件,大度减少项目的维护。
???? 完整的配置如下:

<?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>

????????
<!--?Database?connection?settings?-->
????????
<property?name="connection.driver_class">org.hsqldb.jdbcDriver</property>
????????
<property?name="connection.url">jdbc:hsqldb:hsql://localhost/test</property>
????????
<property?name="connection.username">sa</property>
????????
<property?name="connection.password"></property>

????????
<!--?JDBC?connection?pool?(use?the?built-in)?-->
????????
<property?name="connection.pool_size">1</property>

????????
<!--