0

spring jdbc template don't commit data

asked 2011-08-03 16:00:03 +0800

mhj gravatar image mhj flag of Brazil
806 1 7

i have an application like
http://books.zkoss.org/wiki/Small_Talks/2006/July/ZK_with_Spring_DAO_and_JDBC_Part_II
all is work fine, but when update data, don't save on database.
i think is some problem for commit data.
thanks in advance...

delete flag offensive retag edit

2 Replies

Sort by ยป oldest newest

answered 2011-08-04 06:04:02 +0800

mhj gravatar image mhj flag of Brazil
806 1 7

updated 2011-08-04 06:07:29 +0800

queries work fine, the problem is with the update
no idea?

link publish delete flag offensive edit

answered 2011-08-04 07:42:08 +0800

mhj gravatar image mhj flag of Brazil
806 1 7

updated 2011-08-04 08:17:16 +0800

I solved half the problem, jdbcTemplate is working, but namedParameterJdbcTemplate is not working. below is my spring configuration:

<bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
        <property name="jndiName">
            <value>java:comp/env/dsi</value>
        </property>
    </bean>    
    
    <bean id="jdbcManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"> 
        <property name="dataSource"> 
            <ref bean="dataSource"/> 
        </property>
    </bean>
    
    <bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
        <constructor-arg>
            <ref bean="dataSource" />
        </constructor-arg>
    </bean>
    
    <bean id="namedParameterJdbcTemplate" class="org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate">
        <constructor-arg>
            <ref bean="dataSource" />
        </constructor-arg>
    </bean>
    
    <bean id="appTarget" class="app.gestor.QueryGestor">
        <property name="jdbcTemplate">
            <ref bean="jdbcTemplate" />
        </property>
        <property name="namedParameterJdbcTemplate">
            <ref bean="namedParameterJdbcTemplate" />
        </property>
    </bean>
    
    <bean id="queryGestor" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"> 
        <property name="transactionManager"> 
            <ref bean="jdbcManager"/> 
        </property> 
        <property name="target"> 
            <ref bean="appTarget"/> 
        </property> 
        <property name="transactionAttributes"> 
            <props> 
                <prop key="insert*">PROPAGATION_REQUIRED, ISOLATION_READ_COMMITTED</prop>
                <prop key="update*">PROPAGATION_REQUIRED, ISOLATION_READ_COMMITTED</prop> 
                <prop key="delete*">PROPAGATION_REQUIRED, ISOLATION_READ_COMMITTED</prop>
                <prop key="find*">PROPAGATION_REQUIRED, ISOLATION_READ_COMMITTED, readOnly</prop> 
            </props> 
        </property>
    </bean> 

I need my application to work both ways (with jdbcTemplate and namedParameterJdbcTemplate)

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2011-08-03 16:00:03 +0800

Seen: 750 times

Last updated: Aug 04 '11

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More