This week's book giveaways are in the AI and JavaScript forums.
We're giving away four copies each of GANs in Action and WebAssembly in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of GANs in ActionE this week in the AI forum
or WebAssembly in Action in the JavaScript forum!
  • 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
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
  • Knute Snortum
Sheriffs:
  • Liutauras Vilda
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Joe Ess
  • salvin francis
  • fred rosenberger

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?
 
PI day is 3.14 (march 14th) and is also einstein's birthday. And this is merely a tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!