how can i update the databse for partcular user_id after session is expire ?
shyam ji gautam
Ranch Hand
Joined: Sep 17, 2011
Posts: 46
posted
0
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 .
Tim Moores
Rancher
Joined: Sep 21, 2011
Posts: 2407
posted
0
You can use an HttpSessionListener to get notified whenever a session expires.
shyam ji gautam
Ranch Hand
Joined: Sep 17, 2011
Posts: 46
posted
0
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
Rancher
Joined: Sep 21, 2011
Posts: 2407
posted
0
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
Joined: Sep 17, 2011
Posts: 46
posted
0
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
Rancher
Joined: Sep 21, 2011
Posts: 2407
posted
0
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.