File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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

Handling commit/rollback in application

Anand Bhatt
Ranch Hand

Joined: May 30, 2007
Posts: 189
In my Spring's context file I have defined datasource using:

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

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.

Prashant Kataria
SCJP 5.0

"If you are going through hell, keep going!!!"
I agree. Here's the link:
subject: Handling commit/rollback in application
It's not a secret anymore!