views:

36

answers:

1

I am using Spring 3.0.3, MyBatis 3.0.2 and mybatis-spring 1.0.0 on Apache Tomcat 6.0.29.

I have used declarative transactions of spring for transaction management. The issue is that the transactions are not working for me. The transaction only works once and thereafter nothing.

I have tried checking all my configs but no clue. Any pointers?

My configurations looks like this -

    <tx:advice id="txAdvice" transaction-manager="transactionManager">
        <tx:attributes>
            <tx:method name="*" propagation="REQUIRED" />
        </tx:attributes>
    </tx:advice>

    <aop:config>
        <aop:pointcut id="dtxops"
            expression="execution(* com.service.*.*(..))" />
        <aop:advisor advice-ref="txAdvice" pointcut-ref="dtxops" />
    </aop:config>

EDIT after comment -------------

I start the server and execute some transactional functionality and some times it works and some times it does not. Sometimes it keeps on working for 5-6 times and then suddenly it stops.

TX Manager and DS config -

<bean id="transactionManager"
        class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
        <property name="dataSource">
            <ref bean="dataSource" />
        </property>
    </bean>

<bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
        <property name="resourceRef" value="true" />
        <property name="jndiName" value="java:comp/env/jdbc/MyDBInstance" />
    </bean>
A: 

I am also facing the same issue.Do you got the answer you are looking for

Mukta
You are meant to ANSWER questions not ASK new ones. If you are interested in the answer upvote his question :)
willcodejavaforfood