配置mysql时:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<!-- 方言 -->
<property name="dialect">org.hibernate.dialect.MySQLDialect</property>
<!-- 数据库驱动 -->
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
<!-- 数据库url -->
<property name="connection.url">jdbc:mysql://localhost:3306/test</property>
<!-- 账号 -->
<property name="connection.username">root</property>
<!-- 密码 -->
<property name="connection.password">root</property>
<!-- hibernate管理session的模式 -->
<property name="current_session_context_class">org.springframework.orm.hibernate4.SpringSessionContext</property>
<!-- 显示sql语句 -->
<property name="show_sql">true</property>
<!-- 通过映射文件 创建数据库表结构 -->
<property name="hbm2ddl.auto">update</property>
<mapping resource="base/vo/houseuser.hbm.xml"/>
</session-factory>
</hibernate-configuration>
Oracle数据库:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<!-- 方言 -->
<property name="dialect">org.hibernate.dialect.Oracle10iDialect</property>
<!-- 数据库驱动 -->
<property name="connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
<!-- 数据库url -->
<property name="connection.url">jdbc:oracle:thin:@localhost:1521:orcl</property>
<!-- 账号 -->
<property name="connection.username">scott</property>
<!-- 密码 -->
<property name="connection.password">tiger</property>
<!-- hibernate管理session的模式 -->
<property name="current_session_context_class">org.springframework.orm.hibernate4.SpringSessionContext</property>
<!-- 显示sql语句 -->
<property name="show_sql">true</property>
<!-- 通过映射文件 创建数据库表结构 -->
<property name="hbm2ddl.auto">update</property>
<mapping resource="base/vo/houseuser.hbm.xml"/>
</session-factory>
</hibernate-configuration>