1 Reply Latest reply on Dec 2, 2008 3:24 AM by swd847

    Independent Conversation Cache Invalidation

    jeffdonahoo

      I have two independent conversations and I need to update the session cache in one conversation based on changes in the other conversation.


      For example, I have a car selection application.  In one conversation (user), I am managing user profile information, including favorite color.  In another conversation (car), I am allowing the user to customize a car through a wizard.  If I switch to the user conversation and change my favorite color from red to blue and then switch back to the car conversation (already in progress) and wizard my way to the car color selection page, I want the default car color to be blue (not red like it was when I started the car conversation).  How do I do this in a manner that is transparent to the user?  I know I can switch to the car conversation and call entityManager.refresh(); however, I'd like to be able to invalidate the cache of the car conversation from WITHIN the user conversation.


      Suggestions?

        • 1. Re: Independent Conversation Cache Invalidation
          swd847

          You have to switch to the Conversation, call the method, and then switch back. Even if there was a way of getting access to the other conversations EntityManager because they are not threadsafe you will can run into all kinds of subtle and impossible to reproduce bugs. When you switch to the conversation the conversation is locked so another request will be locked out while you refresh the EntityManager.