Win a copy of Emmy in the Key of Code this week in the General Computing forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Ron McLeod
  • Carey Brown
  • Paweł Baczyński
  • Piet Souris
  • Vijitha Kumara

Seam: DB query returns old data after flush

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?
Proudly marching to the beat of a different kettle of fish... while reading this tiny ad
Java file APIs (DOC, XLS, PDF, and many more)
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!