public static void openSessionAndBindToThread(String bd) {
   Session session = (Session) sessionFactory.get(bd).openSession();
   ThreadLocalSessionContext.bind(session);
 }
 public static void closeSessionAndUnbindFromThread(String bd) {
   Session session = ThreadLocalSessionContext.unbind(sessionFactory.get(bd));
   if (session != null) {
     session.close();
   }
 }
Exemple #3
0
 public static void openSessionAndBindToThread() {
   Session session = sessionFactory.openSession();
   ThreadLocalSessionContext.bind(session);
 }