How expensive do you think it will be to save and bring back the user object from the database? I'm pretty sure that working with that information in memory is faster and less expensive. Why not just staying with the Map solution? I'm pretty sure it works.
cheers, Bruno Borges blog.brunoborges.com.br +55 21 76727099 "The glory of great men should always be measured by the means they have used to acquire it." - Francois de La Rochefoucauld On Wed, Nov 5, 2008 at 1:31 PM, Arthur Leigh Allen < [EMAIL PROTECTED]> wrote: > Hello people! > > I know there are lots of threads with the same issue but I couldn't find a > proper and well solved solution. > > I have a web application with users to login and logout. > If a user logs in the user object is hold in the session. > If the user logs out by using the logout button, the online status of this > user is set to "offline" in the database. > > Well. My problem is the session timeout. > If a session timeout occurs I only can access the session id of the expired > session (am I right?). > So I'm not able to access the user object anymore (?). > > Some of you showed a solution by holding a map or list in the application > class, e.g. key (sessionid) and value (user). > But I think it's expensive (memory). > > It would be more performant to save the session id of the user in the user > database table when the user logs in. > When the timeout occurs I could retrieve the user object from the database > by using the unique session id. > Then I could modify the user object and make it persistent again. > > Does anyone know a better way because I'm not fully satisfied with this > solution, too? > > Best regards! > Allen > > >