求助spring基本事物配置

06-07-03 allenchu
<bean id="UserDAOProxy"

class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">

<property name="transactionManager">

<ref bean="transactionManager" />

</property>

<property name="target">

<ref local="userDAO" />

</property>

<property name="transactionAttributes">

<props>

<prop key="insert*">PROPAGATION_REQUIRED</prop>

<prop key="*">PROPAGATION_REQUIRED,readOnly</

</props>

</property>

</bean>

<bean id="userDAO" class="net.xiaxin.dao.UserDAO">

<property name="dataSource">

<ref local="dataSource" />

</property>

</bean>

1.使用factory.getBean("userDAOProxy")获得的UserDao才纳入事务管理吗?

2.使用factory.getBean("userDAO")获得的UserDao在不在事务中?

---------------------------------------------------------------------------------------

换一种配置

<bean id="UserDAOProxy"

class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">

<property name="transactionManager">

<ref bean="transactionManager" />

</property>

<property name="target">

<ref local="userDAO" />

</property>

<property name="transactionAttributes">

<props>

<prop key="insert*">PROPAGATION_REQUIRED</prop>

<prop key="*">PROPAGATION_REQUIRED,readOnly</

</props>

</property>

</bean>

<bean id="dataSource" class="JndiObjectFactoryBean">

<property name="jndiName">

<value>java:comp/env/jdbc/xxx</value>

</property>

</bean>

<bean id="jdbcTemplate" class="JdbcTemplate">

<property name="dataSource">

<ref local="dataSource" />

</property>

</bean>

<bean id="userDAO" class="net.xiaxin.dao.UserDAO">

<property name="dataSource">

<ref local="jdbcTemplate"/> <!--在数据访问层我只使用jdbcTemplate来进行基本的操作如insert delete update select-->

</property>

</bean>

3.使用factory.getBean("userDAOProxy")获得的UserDao纳入事务管理吗?

4.使用factory.getBean("userDAO")获得的UserDao在不在事务中?

allenchu
2006-07-03 11:09

<bean id="UserDAOProxy"
	class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
	<property name="transactionManager">
		<ref bean="transactionManager" />
	</property>
	<property name="target">
		<ref local="userDAO" />
	</property>
	<property name="transactionAttributes">
		<props>
		<prop key="insert*">PROPAGATION_REQUIRED</prop>
		<prop key="*">PROPAGATION_REQUIRED,readOnly</
		</props>
	</property>
</bean>

<bean id="userDAO" class="net.xiaxin.dao.UserDAO">
	<property name="dataSource">
	<ref local="dataSource" />
	</property>
</bean>
1.使用factory.getBean("userDAOProxy")获得的UserDao才纳入事务管理吗?
2.使用factory.getBean("userDAO")获得的UserDao在不在事务中?


---------------------------------------------------------------------------------------
换一种配置
<bean id="UserDAOProxy"
	class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
	<property name="transactionManager">
		<ref bean="transactionManager" />
	</property>
	<property name="target">
		<ref local="userDAO" />
	</property>
	<property name="transactionAttributes">
		<props>
		<prop key="insert*">PROPAGATION_REQUIRED</prop>
		<prop key="*">PROPAGATION_REQUIRED,readOnly</
		</props>
	</property>
</bean>

<bean id="dataSource" class="JndiObjectFactoryBean">
	<property name="jndiName">
		<value>java:comp/env/jdbc/xxx</value>
	</property>
</bean>
<bean id="jdbcTemplate" class="JdbcTemplate">
	<property name="dataSource">
		<ref local="dataSource" />
	</property>
</bean>
<bean id="userDAO" class="net.xiaxin.dao.UserDAO">
	<property name="dataSource">
		<ref local="jdbcTemplate"/> <!--在数据访问层我只使用jdbcTemplate来进行基本的操作如insert delete update select-->
	</property>
</bean>

3.使用factory.getBean("userDAOProxy")获得的UserDao纳入事务管理吗?
4.使用factory.getBean("userDAO")获得的UserDao在不在事务中?

<p>

猜你喜欢