GrizzlySessionManager implements SessionManager { @Override public Session createSession(final Request request) { SessionFactory sessionFactory = sessionFactoryProvider.get(); org.hibernate.Session hibernateSession = sessionFactory.openSession(); hibernateSession.beginTransaction(); HttpSession entity = new HttpSession(); entity.setSessionTimeout(sessionMaxAge); hibernateSession.save(entity); hibernateSession.getTransaction().commit(); hibernateSession.close(); return asSession(entity); } @Inject  GrizzlySessionManager(final SystemConfiguration c,
                                 final Provider<SessionFactory> sfProvider); @Override Session getSession(final Request request,
                              final String requestedSessionId); @Override Session createSession(final Request request); @Override String changeSessionId(final Request request,
                                  final Session session); @Override String getSessionCookieName(); @Override void setSessionCookieName(final String name); @Override void configureSessionCookie(final Request request,
                                       final Cookie cookie);  }
@Test public void testCreateSession() { Session newSession = manager.createSession(null); org.hibernate.Session hSession = getSession(); HttpSession dbSession = hSession.get(HttpSession.class, IdUtil.fromString(newSession.getIdInternal())); ensureSessionsMatch(dbSession, newSession); }