wood burning stoves 2.0*
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


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Transaction Management in Spring" Watch "Transaction Management in Spring" New topic
Author

Transaction Management in Spring

xsunil kumar
Ranch Hand

Joined: Dec 14, 2009
Posts: 129
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,

Sunil

Bill Gorder
Bartender

Joined: Mar 07, 2010
Posts: 1632
    
    7

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: 129
Thanks a lot. I got the answer.. Thank you very much.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Transaction Management in Spring
 
Similar Threads
PersistanceContext - Extended Scope
Transacton propagation across applications
CMT doesn't commit DB changes in a POJO
Spring 3 and JDO (Java Data Objects)
Struts 2 Actions having Transaction Management capabilities(calling 2 or more Service Layers)