Hibernate与Spring整合,配置文件applicationContext.xml
2012-08-06 17:09
781 查看
applicationContext.xml:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "http://www.springframework.org/dtd/spring-beans-2.0.dtd">
<beans>
<!--注入SessionFactory,完成Hibernate与Spring的整合-->
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName" value="oracle.jdbc.driver.OracleDriver">
</property>
<property name="url" value="jdbc:oracle:thin:@localhost:1521:xiaojingzi">
</property>
<property name="username" value="jiandan"></property>
<property name="password" value="j123"></property>
<property name="maxWait" value="3000"></property>
<property name="validationQuery" value="select count(*) from dual"></property>
</bean>
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource">
<ref bean="dataSource" />
</property>
<property name="mappingResources">
<list>
<value>crm/entity/Worker.hbm.xml</value>
<value>crm/entity/Role.hbm.xml</value>
<value>crm/entity/CustomLevel.hbm.xml</value>
</list>
</property>
<!-- 配置方言-->
<property name="hibernateProperties">
<props>
<!-- 表示允许自动提交 -->
<!--<prop key="hibernate.connection.autocommit">true</prop>-->
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.dialect">
org.hibernate.dialect.Oracle9Dialect
</prop>
</props>
</property>
</bean>
</beans>
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "http://www.springframework.org/dtd/spring-beans-2.0.dtd">
<beans>
<!--注入SessionFactory,完成Hibernate与Spring的整合-->
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName" value="oracle.jdbc.driver.OracleDriver">
</property>
<property name="url" value="jdbc:oracle:thin:@localhost:1521:xiaojingzi">
</property>
<property name="username" value="jiandan"></property>
<property name="password" value="j123"></property>
<property name="maxWait" value="3000"></property>
<property name="validationQuery" value="select count(*) from dual"></property>
</bean>
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource">
<ref bean="dataSource" />
</property>
<property name="mappingResources">
<list>
<value>crm/entity/Worker.hbm.xml</value>
<value>crm/entity/Role.hbm.xml</value>
<value>crm/entity/CustomLevel.hbm.xml</value>
</list>
</property>
<!-- 配置方言-->
<property name="hibernateProperties">
<props>
<!-- 表示允许自动提交 -->
<!--<prop key="hibernate.connection.autocommit">true</prop>-->
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.dialect">
org.hibernate.dialect.Oracle9Dialect
</prop>
</props>
</property>
</bean>
</beans>
相关文章推荐
- spring、hibernate整合核心配置文件applicationContext.xml
- Hibernate与Spring整合,配置文件applicationContext.xml
- ssh整合!Struts.xml、hibernate与spring整合的applicationContext.xml、web.xml文件的配置!
- spring+hibernate applicationContext.xml配置文件写法
- Spring与Hibernate的整合applicationContext.xml中配置
- spring与hibernate集成--spring配置文件applicationContext.xml的配置:
- spring与hibernate的整合问题—Spring的配置文档applicationContext.xml
- Spring整合了CXF的一个applicationContext.xml的配置文件
- hibernate3使用注解,spring配置文件applicationContext.xml的配置
- Spring 整合 hibernate的 applicationContext.xml 数据源配置
- spring+hibernate整合web.xml、applicationContext.xml配置
- spring整合hibernate(注解、xml)applicationContext.xml配置
- SSH整合-关于Spring中applicationContext.xml文件对于事务的一些配置
- SSH整合,applicationContext.xml中配置hibernate映射文件问题
- spring整合hibernate(注解、xml)applicationContext.xml配置
- Spring 整合hibernate和mybatis的 applicationContext.xml的配置
- Hibernate SQL方言 (hibernate.dialect) Spring配置文件applicationContext.xml
- spring整合hibernate(注解、xml)applicationContext.xml配置
- Hibernate SQL方言 (hibernate.dialect) Spring配置文件applicationContext.xml
- Hibernate SQL方言 (hibernate.dialect) Spring配置文件applicationContext.xml