Announcement Announcement Module
No announcement yet.
Not sure, if <tx:advice is applied for my defined method. But traditional way works Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Not sure, if <tx:advice is applied for my defined method. But traditional way works

    I need your help in transaction management in springs.....

    Env -
    Spring version 3.0.5, JDK 1.5, AspectJ 1.6, Websphere 6.1

    I have defined <tx:advice as follows in my spring bean conf file

    <bean id="transactionManager18" class="org.springframework.jdbc.datasource.DataSou rceTransactionManager">
    <property name="dataSource" ref="dataSource18" />

    <tx:advice id="txAdvice" transaction-manager="transactionManager18">
    <tx:method name="storeSendData"/>

    <aopointcut id="myCutTx" expression="execution(* *(..))"/>
    <aop:advisor advice-ref="txAdvice" pointcut-ref="myCutTx"/>


    public class LhrStoreDataAccessBO implements LhrStoreDataAccessBOIface {

    private LhrStoreSendDataAndReceiveDataUtilities storeUtil;
    private JdbcTemplate jdbcTemplate;

    public void storeLhr(LhrStoreDataTO lhrStoreData, JdbcTemplate jdbcTemplate, Map<String, String> appDefaults) throws RuntimeException {
    storeUtil = getStoreUtil();
    this.jdbcTemplate = jdbcTemplate;
    StoreSendDataOutputTO sendDataOutputTo = storeLhrSendData(lhrStoreData, appDefaults);

    public StoreSendDataOutputTO storeLhrSendData(LhrStoreDataTO lhrStoreData, Map<String, String> callingApp) throws RuntimeException {

    StoreSendDataOutputTO sendDataOutputTo = null;
    if(lhrStoreData != null && lhrStoreData.getLhrSendData() != null){
    LhrSendDataTO lhrSendDataTo = lhrStoreData.getLhrSendData();
    sendDataOutputTo = new StoreSendDataOutputTO();

    if(lhrSendDataTo.getApplicant() != null) {
    AplctInfoDataTO aplctInfoData = storeUtil.getAplctInfoDataTO(lhrSendDataTo.getAppl icant(), prodRqstId);
    aplctInfoInsertDao.insertAplctInfo(aplctInfoData, jdbcTemplate);
    throw new RuntimeException("For testing rollback throw runtimeException");


    return sendDataOutputTo;


    I dont see, the data in the database being rolled back when i explicitly throw runtime exception, but it works when instead of using AOP, i use myown transaction class extending TransactionCallbackWithoutResult and overiding the doInTransactionWithoutResult method.

    Can you please provide guidence in what is required to make it work through aop, as i am not even sure even if my advice is applied.. Help is really appreciated!!!

  • #2
    I hope It may help you a littile bit


    • #3
      I have not found the method named storeSendData,should be storeLhrSendData instead?