Announcement Announcement Module
Collapse
No announcement yet.
weird behavior for declarative transactions Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • weird behavior for declarative transactions

    Hi All,

    I hv been trying to understand why the following declarative transaction handling doesnt work....
    its a very straightfwd app to understand the transaction handling capabilities...
    the weird thing happeng during execution is that the impl class i.e. countryServTarget object is not being executed...because when i debug the app, the control doesn't flow into the impl class from the controller. The controller however shows the correct instance of the proxy object.
    secondly, the code doesn't insert the record as required from the impl object...rather as mentioned above, it doesnt simply enter the impl code.
    so i would like the geniuses around to pls help me on this problem...Thanks in advance..
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE beans PUBLIC "-//SPRING/DTD BEAN/EN" "http://www.springframework.org/dtd/spring-beans.dtd">

    <beans>
    <bean id="urlMapping" class="org.springframework.web.servlet.handler.Sim pleUrlHandlerMapping">
    <property name="mappings">
    <props>
    <prop key="/home.htm">homeController</prop>
    <prop key="/showList.htm">listController</prop>
    <prop key="/saveCountry.htm">saveController</prop>
    </props>
    </property>
    </bean>

    <bean id="countryService" class="org.springframework.transaction.interceptor .TransactionProxyFactoryBean">
    <property name="proxyInterfaces">
    <list>
    <value>com.kk.app.CountryService</value>
    </list>
    </property>
    <property name="target">
    <ref bean="countryServTarget"/>
    </property>
    <property name="transactionManager">
    <ref bean="txManager"/>
    </property>
    <property name="transactionAttributeSource">
    <ref bean="tranAttrSource"/>
    </property>
    </bean>

    <bean id="tranAttrSource" class="org.springframework.transaction.interceptor .NameMatchTransactionAttributeSource">
    <property name="properties">
    <props>
    <prop key="saveCountry">
    PROPAGATION_REQUIRES_NEW, ISOLATION_REPEATABLE_READ,-RuntimeException
    </prop>
    </props>
    </property>
    </bean>

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

    <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
    <!-- <property name="driverClassName" value="org.gjt.mm.mysql.Driver"/> -->
    <property name="driverClassName" value="oracle.jdbc.OracleDriver"/>
    <property name="url" value="jdbc:oracle:thin:@127.0.0.1"/>
    <property name="username" value="sdf"/>
    <property name="password" value="sdf"/>
    <!-- <property name="username" value="root"/>
    <property name="password" value="sdfdsf"/> -->
    <property name="maxActive" value="30"/>
    <property name="maxIdle" value="10"/>
    <property name="maxWait" value="1000"/>
    <property name="defaultAutoCommit" value="true"/>
    </bean>

    <bean id="countryValidator" class="com.kk.app.CountryValidator"/>

    <bean id="homeController" class="com.kk.app.HomeController">
    <property name="greeting" value="Manoj"/>
    </bean>

    <bean id="listController" class="com.kk.app.ListController">
    <property name="cs" ref="countryService"></property>
    </bean>

    <bean id="saveController" class="com.kk.app.SaveController">
    <!-- property name="validator" ref="countryValidator"/ -->
    <property name="redirectListPageUrl" value="redirect:./showList.htm"/>
    <property name="cs" ref="countryService"></property>
    <property name="formView" value="editCountry"></property>
    <property name="commandClass" value="com.kk.app.Country"/>
    <property name="commandName" value="country"/>
    </bean>

    <bean id="dbConn" class="com.kk.app.DbConnector">
    </bean>

    <bean id="countryServTarget" class="com.kk.app.CountryServiceImpl">
    <property name="dataSource" ref="dataSource"/>
    </bean>

    <bean id="viewResolver" class="org.springframework.web.servlet.view.Intern alResourceViewResolver">
    <property name="prefix">
    <value>/jsp/</value>
    </property>
    <property name="suffix">
    <value>.jsp</value>
    </property>
    </bean>
    </beans>
Working...
X