I am adding some basic locking functionality that flags an entity as locked when a user loads the row from the database to prevent concurrent modification, I want the lock to be released if the user navigates away from the page but I am having trouble getting this working, I have tried the following...
Making the bean Page scoped and add the 'release' logic to the @Destroy method - Doesnt work as apparently Page scoped beans dont get destroyed on redirect?
Making the bean Conversation scoped and marking the release method with @End(beforeRedirect=true) - But the method is still not called when a different page is loaded?
My understanding of the different contexts and how they are envoked/destroyed is not great, can anybody suggest a way to achieve this?
Is there a way to invoke an action when a user navigates away from a page using pages.xml?