• 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 ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Junilu Lacar
  • Martin Vashko
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Scott Selikoff
  • salvin francis
  • Piet Souris

Seam: DB query returns old data after flush

 
Greenhorn
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?
 
I'm full of tinier men! And a tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!