title: Update database when session of server JBOSS expires
body: <p>I'm using Java, hibernate, SEAM  and Richfaces. </p>
  
  <p>I saved in database a register indicating that the user is login, now i need save in database the moment when the session of server expire. 
  I implemented a class that implements HttpSessionListener. I put in the method sessionDestroyed some like the next:</p>
  
  <pre><code>            ...
              historia.setFechafinal(new Date());
      historia.setGlosa("test");
      historia.setTiempo("tiempo");
      entityManager.persist(historia);   
              ...
  </code></pre>
  
  <p>When i want to persist the object historia an error is throwed. This should be because the component entityManager just not exist because the session has expired.</p>
  
  <p>How can i write in database after the session is expired? I'm rookie in this subject.</p>
  
  <p>Thank youu</p>