01: package com.technoetic.xplanner.db.hibernate;
02:
03: import net.sf.hibernate.Session;
04: import org.apache.log4j.Logger;
05:
06: import com.technoetic.xplanner.util.LogUtil;
07:
08: public class ThreadSession {
09: protected static final Logger LOG = LogUtil.getLogger();
10: private static ThreadLocal threadSession = new ThreadLocal();
11:
12: /**
13: * @deprecated DEBT(SPRING) Should be injected instead
14: */
15: public static Session get() {
16: Object session = threadSession.get();
17: if (LOG.isDebugEnabled()) {
18: LOG.debug("get() --> " + session);
19: }
20: return (Session) session;
21: }
22:
23: public static void set(Session session) {
24: if (LOG.isDebugEnabled()) {
25: LOG.debug("set(" + session + ")");
26: }
27: threadSession.set(session);
28: }
29: }
|