Session session = sessionBoundToThread();
    private void closeSession() throws Exception    {        if (isSessionBoundToThread())        {            debug("Session bound to thread. Closing.");            Session session = sessionBoundToThread();            try            {                session.connection().commit();                sessionBoundToThread().close();            }                         finally            {                resetThreadSession();            }        } else {            debug("No session bound to thread. Can't close.");        }    }