Hi
I have used declarative transaction management to specify that a method called, add(Deal) on a class called DealsHolder should be executed within a transaction. Below is the declaration from the applicationContext.xml :
When I executed the code, I was getting an exception stating that there is no active transaction available. So I put a println into the add(Deal) method where I'm checking what the current TransactionStatus is, just prior to invoking the add method. This is what I got back:Code:<bean id="ptm" class="org.springframework.orm.jdo.JdoTransactionManager"> <property name="persistenceManagerFactory"> <ref bean="pmf"/> </property> </bean> <bean id="dealsHolderTarget" class="za.co.rmb.spj.deals.domain.DealsHolder"/> <bean id="dealsHolder" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"> <property name="transactionManager"> <ref bean="ptm"/> </property> <property name="target"> <ref bean="dealsHolderTarget"/> </property> <property name="transactionAttributes"> <props> <prop key="add*">PROPAGATION_REQUIRED</prop> </props> </property> </bean>
Does anybody have any idea why there is no transaction being propogated through to the code?Code:Exception in thread "main" org.springframework.transaction.NoTransactionException: No TransactionInterceptor-managed TransactionStatus in scope at org.springframework.transaction.interceptor.TransactionInterceptor.currentTransactionStatus(TransactionInterceptor.java:67) at za.co.rmb.spj.deals.domain.DealsHolder.add(DealsHolder.java:59) at za.co.rmb.spj.deals.session.JdoDealRepository.doStore(JdoDealRepository.java:103) at za.co.rmb.spj.deals.session.JdoDealRepository.store(JdoDealRepository.java:99) at za.co.rmb.spj.deals.session.StoreTask.execute(StoreTask.java:29)


Reply With Quote