This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
The moose likes Other Application Frameworks and the fly likes Seam: DB query returns old data after flush Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Other Application Frameworks
Bookmark "Seam: DB query returns old data after flush" Watch "Seam: DB query returns old data after flush" New topic

Seam: DB query returns old data after flush

Ricardo Preston

Joined: Jan 11, 2010
Posts: 7
I have a list of records (1 per line), and each one can be selected and then modified on a separate page. When I modify a record and click the Save button, I'm taken back to the original list (a datatable) which should include the updated record.

Once I click 'Save', the application:
1- Saves the record to DB
2- Re-queries the search list to load the list of records from DB and show in the list page (showing the modified record with latest values).

The issue is that, the modified values are not displayed. The query still returns the old records. Until I open a new browser and re-query, the new changes are not reflected in the list page (even though the changes have gone to the DB).

I use 2 stateful session beans, one to update record (in a long running conversation) and the other that queries the list.

Upon redirecting to the list page I call the query method so that the new values must be shown. I do this via the pages.xml since if I call re-query in the update method, the query() will be in the same conversation. So I first end the Conversation and then call the query() upon loading of the list page (so that they are in two conversations).

In pages.xml :

In update method :

Is this due to objects still being held in Conversation Scope though the Conversation has ended? Or is this because the DB has not committed the transaction yet? How to overcome this problem so that new values are shown? Can someone please help?
I agree. Here's the link:
subject: Seam: DB query returns old data after flush
jQuery in Action, 3rd edition