2 Replies Latest reply on Apr 11, 2008 7:03 PM by modoc

    Sessions, Conversations, and LazyLoading


      I have a session scoped User component.  It has lazily loaded collection properties (user.messages, user.videos, etc...).  I start a long running conversation at login, which allows those attributes to be lazily loaded when needed later on the user's time on the site.  This is all fine.

      The problem is if a user is logged in, which an active session, and hits a page on the site using a bookmark or a link from an e-mail.

      At this time, their session is active, so they are already logged in, however their new page view (from the bookmark or e-mail link) does not have the conversation id in it, so they end up in a new conversation.  This then causes lazy loading of user properties to fail.

      I have a couple ideas on dealing with this, but I wanted to appeal to the Seam community for the best approach.

      Ideas I had last night were:

      Make the user component conversation scope.  This prevents the error, but forces a user to login repeatedly.

      Don't reference lazily loaded properties from the user component, and use a conversation scoped factory instead, which uses the session scoped user object to figure out which user's sub-data to load.  This seems like the better of the two approaches, but still seems hacky to me.


      Thank you in advance.