1
2
3
4
5 package gboat2.base.dao.aspect;
6
7 import org.hibernate.SessionFactory;
8
9
10
11
12
13
14
15 public class SessionFactoryHolder {
16
17 private static final ThreadLocal<SessionFactory> holder = new ThreadLocal<SessionFactory>();
18
19 public static SessionFactory getSessionFactory() {
20 return holder.get();
21 }
22
23 public static void setSessionFactory(SessionFactory sessionFactory) {
24 holder.set(sessionFactory);
25 }
26
27 public static void clearSessionFactory() {
28 holder.remove();
29 }
30
31 }