Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Seam: DB query returns old data after flush  RSS feed

Ricardo Preston
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!