Package de.sub.goobi.persistence

Examples of de.sub.goobi.persistence.HibernateSessionLong


  /*===============================================================*/

  @Override
  public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
    HttpServletRequest myRequest = (HttpServletRequest) request;
    HibernateSessionLong hsl = null;
    Session session = null;

    /* --------------------------------
     * die Hibernate-Session connecten
     * --------------------------------*/
    // das Managed Bean aus der Session holen
    hsl = (HibernateSessionLong) myRequest.getSession().getAttribute("HibernateSessionLong");
    // wenn das Managed Bean bereits in der Http-Session war,
    // dann daraus die Hibernate-Session ermitteln
    if (hsl != null) {
      session = hsl.getSession();
    }
    if (session != null && !session.isConnected()) {
    }

    try {
      chain.doFilter(request, response);
    } catch (Exception e) {
      throw new ServletException(new GUIExceptionWrapper("Unexpected Error.", e));
    } finally {

      /* --------------------------------
       * die Hibernate-Session von der Datenbank trennen
       * --------------------------------*/
      // das Managed Bean aus der Session holen
      hsl = (HibernateSessionLong) myRequest.getSession().getAttribute("HibernateSessionLong");
      // wenn das Managed Bean bereits in der Http-Session war,
      // dann daraus die Hibernate-Session ermitteln
      if (hsl != null) {
        session = hsl.getSession();
        // gibt es eine Hibernate-Session und ist diese mit der DB verbunden,
        // dann wird diese jetzt getrennt
        if (session != null && session.isConnected()) {
          session.disconnect();
        }
View Full Code Here


    }
    return sess;
  }

  public static void createNewHibernateSession() {
    HibernateSessionLong hsl = (HibernateSessionLong) getManagedBeanValue("#{HibernateSessionLong}");
    hsl.getNewSession();
  }
View Full Code Here

TOP

Related Classes of de.sub.goobi.persistence.HibernateSessionLong

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.