Announcement Announcement Module
Collapse
No announcement yet.
Having issues with Transaction Annotations Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Having issues with Transaction Annotations

    Hello,

    I'm struggling with trx annotations using Spring 1.2.2. It seems to work with some interfaces but not others and I have no idea why. I put a debug in the TransactionInterceptor class and it is clear that my interfaces which definitely have annotations never reach the breakpoint while the one interface that works definitely does hit the breakpoint. I even changed the transactional annotation to readonly for the entire interface to try to break a write to the db and the write succeeded. It's obvious that the class is never being considered as having trx annotations. I also tried moving the annotation to the implementation class and still it didn't work.

    There is nothing special about the interface:

    @Transactional
    public interface ItemService {
    ...
    }

    related beans in app context:

    Code:
    <bean
    		class="org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator" />
    	<bean
    		class="org.springframework.transaction.interceptor.TransactionAttributeSourceAdvisor">
    		<property name="transactionInterceptor">
    			<ref bean="transactionInterceptor" />
    		</property>
    	</bean>
    	<bean id="transactionInterceptor"
    		class="org.springframework.transaction.interceptor.TransactionInterceptor">
    		<property name="transactionManager">
    			<ref bean="hibernateTransactionManager" />
    		</property>
    		<property name="transactionAttributeSource">
    			<bean
    				class="org.springframework.transaction.annotation.AnnotationTransactionAttributeSource" />
    		</property>
    	</bean>
    
    <bean id="itemService"
    		class="foo.service.impl.ItemServiceImpl">
    		... &#40;just a bunch of properties&#41;
    	</bean>
    Thanks for any help you can provide,

    Rexxe

  • #2
    Ok, I've narrowed down which interfaces work and which ones don't. It appears as though that an interface with one method works fine but one with more than one method does not work. My ItemService has about 15 methods defined in the interface and none of them go through the TransactionInterceptor.

    Comment


    • #3
      Ok, reverted back to Spring 1.2.1 and it works, so it must be a bug in Spring 1.2.2. I'll add it to Jira.

      Comment

      Working...
      X