It's not a secret anymore!*
The moose likes Spring and the fly likes Handling commit/rollback in application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Handling commit/rollback in application" Watch "Handling commit/rollback in application" New topic
Author

Handling commit/rollback in application

Anand Bhatt
Ranch Hand

Joined: May 30, 2007
Posts: 189
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

Joined: Jul 23, 2007
Posts: 20
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


-
Prashant Kataria
SCJP 5.0

"If you are going through hell, keep going!!!"
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Handling commit/rollback in application