Results 1 to 4 of 4

Thread: Concise proxies, declarative transactions and inheritance

  1. #1
    Join Date
    Nov 2005
    Location
    Munich, Germany
    Posts
    89

    Default Concise proxies, declarative transactions and inheritance

    Hi everybody!

    I've looked at chapter 6.7 Concise proxy definitions and worked the suggestions into my config - works like a charm with a lot less xml!

    Is possible to do the following: I have got a template (an abstract bean -> baseManager) that is extened by actual managers (e.g. entityTypeManager). Now I want to inherit transactionAttributes from my baseManager and declare some additional methods as well. But if I run the example above, only the the "new" methods will be executed within a transaction, which makes sense actually, since I am redefining the transactionAttributes.

    Code:
    <bean id="baseManager" abstract="true"
    		class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
    		<property name="transactionManager" ref="transactionManager"/>
    		<property name="transactionAttributes">
    			<props>
    				<prop key="save*">PROPAGATION_REQUIRED</prop>
    				<prop key="delete*">PROPAGATION_REQUIRED</prop>
    				...
    			</props>
    		</property>
    		...
    	</bean>
    
    <bean id="entityTypeManager" parent="baseManager">
    		<property name="target">
    			...
    		</property>
    		<!-- additional methods that require tx support -->
    		<property name="transactionAttributes">
    			<props>
    				<prop key="getById*">PROPAGATION_REQUIRED</prop>
    				<prop key="getByName">PROPAGATION_REQUIRED</prop>
    			</props>
    		</property>
    	</bean>
    Since this seems to be wrong, I wonder whether there is another approach to solve this (inherit tx-methods and define additional ones) without rewriting the inherited definitions.

    Regards,
    Tom

  2. #2
    Join Date
    Feb 2005
    Location
    Boston, MA
    Posts
    1,142

    Default

    Spring 2.0 supports the concept of collection merging for just such an occassion.
    Bill

  3. #3
    Join Date
    Nov 2005
    Location
    Munich, Germany
    Posts
    89

    Default

    Thanks for your reply - that's exactly what I was looking for. Is there any chance that this will be backported into the 1.2 branch?

    Regards,
    Tom

    BTW: Is there a migration guide available concerning the transition from Spring 1.2 to 2.0?

  4. #4
    Join Date
    Aug 2004
    Location
    Montréal, Canada
    Posts
    845

    Default

    2.0 is a drop in replacement for Spring 1.X.

    HTH.
    Last edited by irbouho; May 29th, 2006 at 10:08 PM.
    Omar Irbouh

    Spring Modules Team
    http://irbouh.blogspot.com/

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •