Thread « Session « JPA Q&A





2. Session and threads    forum.hibernate.org

We're about to create a new hibernate app which will be multithreaded. So we have this: BusinessObj { public ServiceA { } public ServiceB { } } ServiceA and ServiceB will be called concurrently via RMI. Two clients can call a service simultaniously. Also, one client can call ServiceA while another client calls ServiceB Should we put a Session/Transaction in each ...

3. SessionFactory thread cleanup.    forum.hibernate.org

Configuration: Tomcat 5.0.19 java 1.4.2_04 hibernate 2.1.2 I have a web application that uses hibernate, in a ServletContextListener I am shutting down hibernate: sessionFactory.close() When I shutdown hibernate I expect that all hibernate related thread would be shutdown however I see 2: Store net.sf.hibernate.cache.QueryCache Spool Store net.sf.hibernate.cache.UpdateTimestampsCache Why isn't hibernate cleaning up these threads? Raj[/list]

4. Why is the thread be blocked? about session.    forum.hibernate.org

hi, all there is a timer in my program, and it does same database operations periodly. Everytime, it creates a new session, does some operations, then closes the session. The code likes this: Session session = null; try { session = sessionFactory.openSession(); ... session.save(obj); session.flush(); session.connection().commit(); ... session.close(); } catch(...) When it is doing these operations, I cut off the connection ...

5. Using hibernate Session from a java Thread    forum.hibernate.org

public class HibernateSession { public static final ThreadLocal session = new ThreadLocal(); public static Session currentSession() throws HibernateException { Session s = (Session) session.get(); if (s == null) { ...

6. Code in a Session is executed in a Thread?    forum.hibernate.org

The code you indicate will be executed in as many threads as there are, at any given time, accessing that code simultaneously. Hopefully, only one, but there is no guarantee. In other words, the code you describe is not thread safe. If you have the reasonable expectation that the session code might be accessed by more than one thread at a ...

7. seperate sessions on same thread    forum.hibernate.org

Hibernate version: 3.3.1 GA Name and version of the database you are using: postgres 8 Hey, I'd like to customise my session factory scope - currently it is as per usual, it is bound to the current thread, meaning any transaction on the thread will use the same sessionfactory/session. usually this works just fine however... my current project does 2 things ...