An attempt to fix the issue with the password change not saving when done from the profile screen. It appears that when the session is "closed", the hibernate session is unbound from the Spring transaction and as the hibernate session is kept open by the filter, the flush is never triggered. So any changes to objects that are attached to the session but not written out to the db will not be flushed.
At present, some of our updates (e.g. the main edit profile page) only work because the later calls (within the overall URL call) reget the data e.g. the learner's details and that triggers a flush.
Added a manual flush - it feels like a bit of a sledgehammer but hopefully it will fix it rather than the "coding around" that we have been doing previously.