• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Transaction doesn't rollback

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear all:
My Spring configuration is as follows:
<bean id="dataSource"
class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName" value="java:comp/env/jdbc/oraclekom" />
</bean>

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

<tx:advice id="txAdvice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="doDelete*" />
<tx:method name="doUpdate*" />
<tx:method name="doInsert*" />
<tx:method name="move*" />
</tx:attributes>
</tx:advice>

<aop:config>
<aop ointcut id="vdmServiceMethods" expression="execution(* tw.com.yl.vdm.bso.*BSO.*(..))" />
<aop:advisor advice-ref="txAdvice" pointcut-ref="vdmServiceMethods"/>
</aop:config>


I have a method in class "VD15BSO.java" under package "tw.com.yl.vdm.bso" whose method name is "doUpdateJobChecksFromExcel". This method would access two tables via dao object. First dao deletes and inserts data into database,
and second dao occurs error while it inserts data into database. The delete and insert action of first dao won't rollback.

Does anyone know that where my configuration is wrong?
 
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I never use AOP for transaction management. I use annotation based transaction configuration. So in my applicationContext.xml I have:

<tx:annotation-ddriven transaction-manager="transactionManager" />

And my service classes have @Transaction on the methods. Everything rolls back and commits just fine.
 
Vince Chen
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But my runtime environment is jdk 1.4.x. It cannot use annotation, is it?
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Vince Chen:
But my runtime environment is jdk 1.4.x. It cannot use annotation, is it?



That is true.
 
Ranch Hand
Posts: 387
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi Vince,

compare your config to: http://www.springframework.org/docs/Spring-MVC-step-by-step/part6.html#step6.4
Note that the "ProductManager" there is an interface.

And did you check your logs for errors?

Herman
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would second Herman's advice, turn logging on DEBUG and watch the logs. Does it begin a transaction? If not then something in your aop configuration is wrong.
 
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please also provide the service methods. What persistence f/w are you using?
 
You are HERE! The other map is obviously wrong. Better confirm with this tiny ad:
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
    Bookmark Topic Watch Topic
  • New Topic