I updated the UserEJB again to add the previous last visit date.
The idea is to have lastVisit and previousLastVisit. When the user makes request, the lastVisit field is updated with the current time.
When the user logs in, the lastVisit field is copied over the previousLastVisit field.
Otherwise I fixed some nasty bugs introduced by previous optimizations on memory. The bb of two days ago was not releasing the javassist objects used to create the templates and hence was consuming a lot of memory.