Situation:
- App A (war running on a tomcat 7, rest interface for a web app)
- App B (java standalone, scheduled batch jobs loading data from a file into a database)
- In between a shared control table with a record per file.
- App A correctly persists new record in the control table and sets appropriate state (pending), signalling App B to start processing.
- Web app correctly displays the state as pending.
- App B processes that batch, loads the data and correctly sets new state (processed) signalling the load has been completed. This is easily verified by simple query with fx Squirrel.
- When refreshing the page in the web app the state is incorrectly displayed as pending instead of the correct state: processed. When debugging the response, the state variable is assigned pending. My logs indicate the query taking place on the refresh.
- If I reboot my Tomcat the next query will show the correct result, i.e the state as processed. This also puzzles me, what besides EntityManager is maintaining the database object??
Problem: I just cannot figure out why App A continues to see the state as pending. I've already tried a number of things to ensure that the entityManager has it's cache cleared (both for App A and App B) but still App A queries end up getting the wrong state.