I am seeking assistencew with resolving an issue that has me baffled; maybe YOU can help!
The Givens:
- we have an application built using a Stripes/Spring/Hibernate frameworks environment
- our upload/import process is a long running process that can timeout, depending on how much data is being processed
- our data calls (crud) are developed using a few different programming techniques, all of which work (save for the occaisional timeout); these include:
1) getHibernateTemplete().findBy*(); getHibernateTemplete().save(); etc.
2) Criteria query = getHibernateTemplate().getSessionFactory().getCurrentSession().createCriteria( ourClass.class );
3) Criteria query = getSession.createCriteria( ourClass.class );
Our Plan:
In order to resolve the timeout issue stated above, we decided to launch an asynchronous thread to do the intense processing while the user looks at a spinner page (which sleeps; wakes; checks status; sleeps again if still processing; redirects to a summary page if processing has completed).
What I did:
1.0) first, I moved the processing logic to a thread. This caused the following problem: 1.1) all statements of Type 2 (above) throw this exception: No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional one here
2.0) so, I changed all statements of Type 2 (above) to statements of Type 3 (above) 2.1) new problem: now process hangs waiting for JDBC connections
3.0) so, I added the following: 3.1) <prop key="hibernate.connection.release_mode">after_transaction</prop> 3.2) This seems to work, but I am unsure if these changes I made are "good" (ie, desirable) or not
4.0) I then tried using a DetachedCriteria for those statements of Type 2 (above); now, I get 4.1) failed to lazily initialize a collection of role: gov.epa.glnpo.data.Person.persTelephones, no session or session was closed
My Question:
1) which is the best format I should use for creating Criteria queries? 2) which of the changes (that I have described above) are good choices and which are not. 3) what am I missing from my environment that prevents my solution from working perfectly?
I appreciate you reading my post and for any insights you may provide
thanks
Chas
|