开发者

Spring jdbc with aop transaction configuration not committing

开发者 https://www.devze.com 2023-04-09 18:26 出处:网络
I am using Spring 3.0.6 in Tomcat 6 with JDK 1.6. I have configured Spring JDBC with declarative transaction using the Spring reference. I see following in the log for my delete query but after the ex

I am using Spring 3.0.6 in Tomcat 6 with JDK 1.6. I have configured Spring JDBC with declarative transaction using the Spring reference. I see following in the log for my delete query but after the execution the record does not get deleted. Any idea what is the reason?

Creating new transaction with name [com.accept.web.modules.personalization.UserPreferencesServiceImpl.delete]: PROPAGATION_REQUIRED,ISOLATION_DEFAULT
Acquired Connection [ProxyConnection[PooledConnection[oracle.jdbc.driver.T4CConnection@73bddb4e]]] for JDBC transaction
Bound value [org.springframework.jdbc.datasource.ConnectionHolder@3f6f1ea2] for key [org.apache.tomcat.jdbc.pool.DataSource@1123065c{ConnectionPool[defaultAutoCommit=null; defaultReadOnly=null; defaultTransactionIsolation=-1; defaultCatalog=null; driverClassName=oracle.jdbc.OracleDriver; maxActive=30; maxIdle=3; minIdle=0; initialSize=0; maxWait=30000; testOnBorrow=false; testOnReturn=false; timeBetweenEvictionRunsMillis=600000; numTestsPerEvictionRun=0; minEvictableIdleTimeMillis=1800000; testWhileIdle=true; testOnConnect=false; password=accept; url=jdbc:oracle:thin:@bbhangale-pc:1521/bbhangale; username=accept; validationQuery=select name from usr_user where id=104; validationInterval=1200000; accessToUnderlyingConnectionAllowed=true; removeAbandoned=true; removeAbandonedTimeout=360; logAbandoned=true; connectionProperties=null; initSQL=null; jdbcInterceptors=null; jmxEnabled=true; fairQueue=true; useEquals=true; abandonWhenPercentageFull=0; maxAge=0; useLock=false; dataSource=null; dataSourceJNDI=null; alternateUsernameAllowed=false; }] to thread [http-8001-1]
Initializing transaction synchronization
Getting transaction for [com.accept.web.modules.personalization.UserPreferencesServiceImpl.delete]
Executing prepared SQL update
Executing prepared SQL statement [SELECT "KEY", "VALUE" FROM config WHERE "KEY" IN (?) AND user_id = ?]
Retrieved value [org.springframework.jdbc.datasource.ConnectionHolder@3f6f1ea2] for key [org.apache.tomcat.jdbc.pool.DataSource@1123065c{ConnectionPool[defaultAutoCommit=null; defaultReadOnly=null; defaultTransactionIsolation=-1; defaultCatalog=null; driverClassName=oracle.jdbc.OracleDriver; maxActive=30; maxIdle=3; minIdle=0; initialSize=0; maxWait=30000; testOnBorrow=false; testOnReturn=false; timeBetweenEvictionRunsMillis=600000; numTestsPerEvictionRun=0; minEvictableIdleTimeMillis=1800000; testWhileIdle=true; testOnConnect=false; password=accept; url=jdbc:oracle:thin:@bbhangale-pc:1521/bbhangale; username=accept; validationQuery=select name from usr_user where id=104; validationInterval=1200000; accessToUnderlyingConnectionAllowed=true; removeAbandoned=true; removeAbandonedTimeout=360; logAbandoned=true; connectionProperties=null; initSQL=null; jdbcInterceptors=null; jmxEnabled=true; fairQueue=true; useEquals=true; abandonWhenPercentageFull=0; maxAge=0; useLock=false; dataSource=null; dataSourceJNDI=null; alternateUsernameAllowed=false; }] bound to thread [http-8001-1]
Setting SQL statement parameter value: column index 1, parameter value [FILTER_rcaGrid], value class [java.lang.String], SQL type unknown
Setting SQL statement parameter value: column index 2, parameter value [107], value class [java.lang.Integer], SQL type unknown
Retrieved value [org.springframework.jdbc.datasource.ConnectionHolder@3f6f1ea2] for key [org.apache.tomcat.jdbc.pool.DataSource@1123065c{ConnectionPool[defaultAutoCommit=null; defaultReadOnly=null; defaultTransactionIsolation=-1; defaultCatalog=null; driverClassName=oracle.jdbc.OracleDriver; maxActive=30; maxIdle=3; minIdle=0; initialSize=0; maxWait=30000; testOnBorrow=false; testOnReturn=false; timeBetweenEvictionRunsMillis=600000; numTestsPerEvictionRun=0; minEvictableIdleTimeMillis=1800开发者_如何学编程000; testWhileIdle=true; testOnConnect=false; password=accept; url=jdbc:oracle:thin:@bbhangale-pc:1521/bbhangale; username=accept; validationQuery=select name from usr_user where id=104; validationInterval=1200000; accessToUnderlyingConnectionAllowed=true; removeAbandoned=true; removeAbandonedTimeout=360; logAbandoned=true; connectionProperties=null; initSQL=null; jdbcInterceptors=null; jmxEnabled=true; fairQueue=true; useEquals=true; abandonWhenPercentageFull=0; maxAge=0; useLock=false; dataSource=null; dataSourceJNDI=null; alternateUsernameAllowed=false; }] bound to thread [http-8001-1]
SQL update affected 1 rows
Retrieved value [org.springframework.jdbc.datasource.ConnectionHolder@3f6f1ea2] for key [org.apache.tomcat.jdbc.pool.DataSource@1123065c{ConnectionPool[defaultAutoCommit=null; defaultReadOnly=null; defaultTransactionIsolation=-1; defaultCatalog=null; driverClassName=oracle.jdbc.OracleDriver; maxActive=30; maxIdle=3; minIdle=0; initialSize=0; maxWait=30000; testOnBorrow=false; testOnReturn=false; timeBetweenEvictionRunsMillis=600000; numTestsPerEvictionRun=0; minEvictableIdleTimeMillis=1800000; testWhileIdle=true; testOnConnect=false; password=accept; url=jdbc:oracle:thin:@bbhangale-pc:1521/bbhangale; username=accept; validationQuery=select name from usr_user where id=104; validationInterval=1200000; accessToUnderlyingConnectionAllowed=true; removeAbandoned=true; removeAbandonedTimeout=360; logAbandoned=true; connectionProperties=null; initSQL=null; jdbcInterceptors=null; jmxEnabled=true; fairQueue=true; useEquals=true; abandonWhenPercentageFull=0; maxAge=0; useLock=false; dataSource=null; dataSourceJNDI=null; alternateUsernameAllowed=false; }] bound to thread [http-8001-1]
Completing transaction for [com.accept.web.modules.personalization.UserPreferencesServiceImpl.delete]
Triggering beforeCommit synchronization
Triggering beforeCompletion synchronization
Initiating transaction commit
Committing JDBC transaction on Connection [ProxyConnection[PooledConnection[oracle.jdbc.driver.T4CConnection@73bddb4e]]]
Triggering afterCommit synchronization
Triggering afterCompletion synchronization
Clearing transaction synchronization
Removed value [org.springframework.jdbc.datasource.ConnectionHolder@3f6f1ea2] for key [org.apache.tomcat.jdbc.pool.DataSource@1123065c{ConnectionPool[defaultAutoCommit=null; defaultReadOnly=null; defaultTransactionIsolation=-1; defaultCatalog=null; driverClassName=oracle.jdbc.OracleDriver; maxActive=30; maxIdle=3; minIdle=0; initialSize=0; maxWait=30000; testOnBorrow=false; testOnReturn=false; timeBetweenEvictionRunsMillis=600000; numTestsPerEvictionRun=0; minEvictableIdleTimeMillis=1800000; testWhileIdle=true; testOnConnect=false; password=accept; url=jdbc:oracle:thin:@bbhangale-pc:1521/bbhangale; username=accept; validationQuery=select name from usr_user where id=104; validationInterval=1200000; accessToUnderlyingConnectionAllowed=true; removeAbandoned=true; removeAbandonedTimeout=360; logAbandoned=true; connectionProperties=null; initSQL=null; jdbcInterceptors=null; jmxEnabled=true; fairQueue=true; useEquals=true; abandonWhenPercentageFull=0; maxAge=0; useLock=false; dataSource=null; dataSourceJNDI=null; alternateUsernameAllowed=false; }] from thread [http-8001-1]
Releasing JDBC Connection [ProxyConnection[PooledConnection[oracle.jdbc.driver.T4CConnection@73bddb4e]]] after transaction
Returning JDBC Connection to DataSource


All is working fine now. I forgot to change the query to a delete query. As you pointed you cannot see any delete query in the logs.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号