Win a copy of Modern JavaScript for the Impatient this week in the Server-Side JavaScript and NodeJS forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

how can i update the databse for partcular user_id after session is expire ?

 
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
dear all


i want to update the data for particular userid in database after session is expire how i can do this ?

first i elaborate the actual requirement in my application i want then when session time out happen then one particular flag for user id like 'test' is set ='no' and send the page to login.jsp
using filter
i am using hybernate so how can i update that flag for particular userid after the session is expire using hybernate .

 
Saloon Keeper
Posts: 6584
160
Android Mac OS X Firefox Browser VI Editor Tomcat Server Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use an HttpSessionListener to get notified whenever a session expires.
 
shyam ji gautam
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am using hybernate so how it will be doing in hybernate and my doubt is that how i pass the particular id key for update the row.
 
Tim Moores
Saloon Keeper
Posts: 6584
160
Android Mac OS X Firefox Browser VI Editor Tomcat Server Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You would get the ID out of the session (where, obviously, you'd need to store it first). The rest is just JDBC/Hibernate.
 
shyam ji gautam
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks

i am also confue can you give some code like we wnt to update data for user_id ='test' ;

then if session time out then how we use this id for update in databse in listener as your suggestion , any example
 
Tim Moores
Saloon Keeper
Posts: 6584
160
Android Mac OS X Firefox Browser VI Editor Tomcat Server Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What difference does it make whether you call this code from within a servlet context listener, or any other place? I think for DB questions there's a separate forum here which would be better suited.
 
Bartender
Posts: 2856
10
Firefox Browser Fedora Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is one example of session listener.
    Bookmark Topic Watch Topic
  • New Topic