I think I must be missing something basic - my apologies in advance. I have started using Hibernate with the ThreadLocal session pattern for a read-only Struts based application. A user submits a query, gets a session, gets results, and then returns to do another search. The problem is that everytime the same user searches, a new session is created and the objects that were generated for the previous search remain in memory - I can see them growing in a profiler on each user submission. The session appears to be gone in that the class with the Threadlocal pattern can't find it, but its still there with its objects in memory. If I could get it back I could disconnect or evict objects or something like that, but I don't know when to do that until a user actually resubmits a query, and by then the session appears to be gone. Any hints on what I am doing wrong? I would include the code but it is exactlhy whats in the hibernate doc for the quickstart with Tomcat. When I just get a Session in a singleton manner, the memory problem goes away - might this be safe for this type of application - read only?
sg
|