@Override public <T> T execute(SessionCallback<T> cb) { if (sessionContext.getCurrentSession() != null) { return cb.doInSession(sessionContext.getCurrentSession()); } else { Session session = openSession(); try { return cb.doInSession(session); } finally { session.close(); } } }