clearwa wrote:
"... never create more than one concurrent session or transaction per database connection"; it take this to mean that each thread should have it's own SessionFactory despite the assretion that SessionFactories are thread safe and intended to be shared (is this correct?).
No use 1 SessionFactory for all your threads and sf.openSession() for each thread. What is forbidden is to share the same connection object between several sessions
Code:
Connection conn;
Session s1 = sf.openSession(conn);
Session s2 = sf.openSession(conn);
// this is forbidden
Since session object isn't thread safe, the don't share sessions between threads.