Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Handling commit/rollback in application

 
Anand Bhatt
Ranch Hand
Posts: 189
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
In my Spring's context file I have defined datasource using:
org.springframework.jdbc.datasource.DriverManagerDataSource

Now in my application code I am taking Connection using dataSource.getConnection();
My qiery is that After running sql quries should I write code to rollback() or commit() manully.
From my understandin g Spring is reponsible for automatically doing so.
 
Prashant R Kataria
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There are two types of transaction management

Programatic: What you just did.

Declarative: Which will use aop of spring and do comit and rollback for you as per the configuration provided.

Go to the link below, search for the declarative transaction there.
http://static.springsource.org/spring/docs/2.0.x/reference/transaction.html
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic