Spring 3 + Hibernate4 事务不成功可能是哪些原因引起的
1个回答
展开全部
一、配置如下:
1)applicationContext-common.xml
Java代码
<?xml version="1.0" encoding="UTF-8"?>
<!-- 加载jdbc配置文件 -->
<context:property-placeholder location="classpath:jdbc.properties" />
<!-- 配置数据源dataSource -->
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close">
<property name="driverClassName" value="${jdbc.driverClassName}" />
<property name="url" value="${jdbc.url}" />
<property name="username" value="${jdbc.username}" />
<property name="password" value="${jdbc.password}" />
<property name="validationQuery" value="SELECT 1" />
<property name="testWhileIdle" value="true" />
<property name="timeBetweenEvictionRunsMillis" value="3600000" />
<property name="minEvictableIdleTimeMillis" value="18000000" />
<property name="testOnBorrow" value="true" />
</bean>
1)applicationContext-common.xml
Java代码
<?xml version="1.0" encoding="UTF-8"?>
<!-- 加载jdbc配置文件 -->
<context:property-placeholder location="classpath:jdbc.properties" />
<!-- 配置数据源dataSource -->
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close">
<property name="driverClassName" value="${jdbc.driverClassName}" />
<property name="url" value="${jdbc.url}" />
<property name="username" value="${jdbc.username}" />
<property name="password" value="${jdbc.password}" />
<property name="validationQuery" value="SELECT 1" />
<property name="testWhileIdle" value="true" />
<property name="timeBetweenEvictionRunsMillis" value="3600000" />
<property name="minEvictableIdleTimeMillis" value="18000000" />
<property name="testOnBorrow" value="true" />
</bean>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询