<bean id="myAccountManager" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
<property name="transactionManager"><ref bean="transactionManager"/></property>
<property name="target"><ref local="myAccountManagerTarget"/></property>
<property name="transactionAttributes">
<props>
<prop key="save*">PROPAGATION_REQUIRED</prop>
<prop key="remove*">PROPAGATION_REQUIRED</prop>
<prop key="delete*">PROPAGATION_REQUIRED</prop>
<prop key="*">PROPAGATION_REQUIRED,readOnly</prop>
</props>
</property>
</bean>
分享到:
相关推荐
<prop key="save*">update</prop> <prop key="remove*">update</prop> <prop key="add*">update</prop> <prop key="del*">update</prop> <prop key="get*">readOnly</prop> <prop key=...
<prop key="save*">PROPAGATION_REQUIRED</prop> <prop key="insert*">PROPAGATION_REQUIRED</prop> <prop key="del*">PROPAGATION_REQUIRED</prop> <prop key="add*">PROPAGATION_REQUIRED</prop> </props> ...
<prop key="save*">PROPAGATION_REQUIRED</prop> <prop key="find*">PROPAGATION_REQUIRED,readOnly</prop> </props> </property> </bean> ``` - **通用事务配置** 为了进一步简化代码并提高可重用性,...
<prop key="save*">PROPAGATION_REQUIRED</prop> <prop key="find*">PROPAGATION_REQUIRED,readOnly</prop> </props> </property> </bean> ``` 在上面的代码中,我们定义了一个名为transactionInterceptor的...
-- 配置拦截器,定义事务规则 --> <property name="transactionAttributes"> <props> <prop key="*">PROPAGATION_REQUIRED,readOnly</prop> <prop key="save*">PROPAGATION_REQUIRED,-Exception</prop> <prop ...
<prop key="save*">PROPAGATION_REQUIRED</prop> <prop key="insert*">PROPAGATION_REQUIRED</prop> <prop key="del*">PROPAGATION_REQUIRED</prop> <prop key="add*">PROPAGATION_REQUIRED</prop> </props> ...
<prop key="*">PROPAGATION_SUPPORTS,readOnly</prop> </props> </property> </bean> ``` #### 四、事务属性详解 在事务代理配置中,我们定义了四种类型的事务传播行为: - `PROPAGATION_REQUIRED`: 如果当前...
<prop key="save*">PROPAGATION_REQUIRED</prop> <prop key="find*">PROPAGATION_REQUIRED,readOnly</prop> <prop key="delete*">PROPAGATION_REQUIRED</prop> <prop key="update*">PROPAGATION_REQUIRED</prop>...
<prop key="save*">PROPAGATION_REQUIRED</prop> <prop key="delete*">PROPAGATION_REQUIRED</prop> <prop key="update*">PROPAGATION_REQUIRED</prop> </props> </property> </bean> ``` 上述配置中,`...
<prop key="save*">PROPAGATION_REQUIRED</prop> <prop key="find*">PROPAGATION_SUPPORTS,readOnly</prop> <prop key="get*">PROPAGATION_SUPPORTS,readOnly</prop> <!-- 更多的方法可以按需添加 --> </props>...
<prop key="save*">PROPAGATION_REQUIRED</prop> <prop key="insert*">PROPAGATION_REQUIRED</prop> </props> </property> </bean> ``` 这段配置定义了一个事务代理工厂bean,指定了事务管理器,并且为方法命名...
<prop key="save*">PROPAGATION_REQUIRED,readOnly</prop> <prop key="update*">PROPAGATION_REQUIRED</prop> <prop key="delete*">PROPAGATION_REQUIRED</prop> </props> </property> </bean> ``` ### 第二种...
<prop key="save*">PROPAGATION_REQUIRED,-Exception</prop> <prop key="update*">PROPAGATION_REQUIRED,-Exception</prop> <prop key="delete*">PROPAGATION_REQUIRED,-Exception</prop> </props> </property>...
<tx:method name="save*" propagation="REQUIRED"/> <tx:method name="update*" propagation="REQUIRED"/> <tx:method name="find*" read-only="true"/> <tx:method name="delete*" propagation="REQUIRED"/> ...
<prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop> <prop key="hibernate.show_sql">true</prop> </props> </property> </bean> <bean id="transactionManager" class="org.spring...
<prop key="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</prop> <prop key="hibernate.show_sql">true</prop> <prop key="hibernate.hbm2ddl.auto">update</prop> <prop key=...
<url-pattern>/*</url-pattern> </filter-mapping> ``` #### 三、总结 通过以上分析可以看出,SSH框架通过Spring进行依赖管理和控制反转,利用Struts2处理用户请求,而Hibernate则负责持久化操作。这种组合不仅...
<prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop> <prop key="hibernate.show_sql">true</prop> <prop key="hibernate.format_sql">true</prop> <prop key="hibernate.hbm2ddl.auto">...
<prop key="hibernate.dialect">org.hibernate.dialect.MySQL5Dialect</prop> <prop key="hibernate.hbm2ddl.auto">update</prop> <!-- 其他Hibernate配置 --> </props> </property> <property name=...
<prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop> <prop key="hibernate.show_sql">true</prop> </props> </property> </bean> <!-- 事务管理器配置 --> <bean id=...