On 7/8/07, Dale Newfield <[EMAIL PROTECTED]> wrote:
Matt Raible wrote:
> It should be OK to call one manager from another

And would you get the handle to the other Manager in the same way we do
for daos, using spring injection?

Yes.


> The transaction boundaries are PROPOGATION_REQUIRED, which means
> "participate in a transaction if one exists, otherwise, start a new
> one".

Where is this set?  I've tried to update my AppFuse1.9.4 based app to
use spring2, and I'm now thinking that I may have done that incorrectly...


The following line does this:

<aop:advisor id="managerTx" advice-ref="txAdvice"
pointcut="execution(* *..service.*Manager.*(..))" order="2"/>

It basically says, wrap any interface in the service package that ends
with "Manager" with a transaction. Because of this, it's important to
set your dependencies to interfaces, not to implementations.

Matt


My applicationContext-service.xml begins with:


<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
        xmlns:aop="http://www.springframework.org/schema/aop";
xmlns:tx="http://www.springframework.org/schema/tx";
        xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
             http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
             http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-2.0.xsd";>

     <aop:config>
         <aop:advisor id="userManagerTx"
advice-ref="userManagerTxAdvice" pointcut="execution(*
*..service.UserManager.*(..))" order="0"/>
         <aop:advisor id="userManagerSecurity"
advice-ref="userSecurityAdvice" pointcut="execution(*
*..service.UserManager.saveUser(..))" order="1"/>
         <aop:advisor id="managerTx" advice-ref="txAdvice"
pointcut="execution(* *..service.*Manager.*(..))" order="2"/>
     </aop:config>

     <tx:advice id="txAdvice">
         <tx:attributes>
             <tx:method name="*"/>
         </tx:attributes>
     </tx:advice>

     <tx:advice id="userManagerTxAdvice">
         <tx:attributes>
             <tx:method name="save*" rollback-for="UserExistsException"/>
         </tx:attributes>
     </tx:advice>

This is definitely an area where I've not taken the time to read enough
to feel that this is anything other than magic, so any advice would be
appreciated...


-Dale

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




--
http://raibledesigns.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to