code: protected Session createSessionProxy(Session session) {
          Class<?>[] sessionIfcs;
          Class<?> mainIfc = Session.class;
          if (session instanceof EventSource) {
              sessionIfcs = new Class[]{mainIfc, EventSource.class};
          } else if (session instanceof SessionImplementor) {
              sessionIfcs = new Class[]{mainIfc, SessionImplementor.class};
          } else {
              sessionIfcs = new Class[]{mainIfc};
          }
          return (Session) Proxy.newProxyInstance(session.getClass().getClassLoader(), sessionIfcs,
                  new CloseSuppressingInvocationHandler(session));
      }
docs: Create a close-suppressing proxy for the given Hibernate Session. The
  proxy also prepares returned Query and Criteria objects.
  
  @param session the Hibernate Session to create a proxy for
  @return the Session proxy
  @see org.hibernate.Session#close()
  @see #prepareQuery
  @see #prepareCriteria