File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Spring and the fly likes Transaction Management in Spring Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Transaction Management in Spring" Watch "Transaction Management in Spring" New topic

Transaction Management in Spring

xsunil kumar
Ranch Hand

Joined: Dec 14, 2009
Posts: 137
Hi All,

I am using Spring along with JPA for persistence. Transaction are getting managed by Spring. I came across a situation where i need to commit the transaction. Below is the senarios

1. Method A has Updates columns of the table.
2. After update, method A calls web service (Another application) to generate reports. In web service, we pull the data from same database.
3. Still JPA/Spring has not committed the transaction. Because of this, in web service we are getting the old data not updated in method A calls.

Only one solution, i can think is to commit the transaction before calling webservice. Even if i tried Entity.flush() method also but it is also not committing the transaction.

Transaction is getting committed at the end of the method call. (Post web service call).

Please advice,


Bill Gorder

Joined: Mar 07, 2010
Posts: 1682

The transaction is not committed until the method returns. So split it out. Psedo code below

[How To Ask Questions][Read before you PM me]
xsunil kumar
Ranch Hand

Joined: Dec 14, 2009
Posts: 137
Thanks a lot. I got the answer.. Thank you very much.
I agree. Here's the link:
subject: Transaction Management in Spring
It's not a secret anymore!