Package com.googlecode.s2hibernate.lang

Examples of com.googlecode.s2hibernate.lang.SessionInjectionException


        sbErrorMessage.append("Could not open or inject a Hibernate Session in ValueStack: ");
        sbErrorMessage.append(e.getMessage());
        String message = sbErrorMessage.toString();
        System.err.println(message);
        e.printStackTrace();
        throw new SessionInjectionException(message);
      }
     
      if (!sessionNotInjected) {
        try {
          if (transactionTarget!=null && (!transactionTarget.equals(""))) {
            injectHibernateTransactionByConfiguration(fields, injectedSessions, invocation);
          }
          injectHibernateTransactionByAnnotation(action, injectedSessions.iterator().next(), false);
          for (Session hibernateSession:injectedSessions) {
            Transaction hibernateTransation = hibernateSession.getTransaction();
            if (!hibernateTransation.isActive())
              hibernateTransation.begin();
          }
        } catch (Exception e) {
          sbErrorMessage.append("Could not open or put a Hibernate Transaction in ValueStack: ");
          sbErrorMessage.append(e.getMessage());
          String message = sbErrorMessage.toString();
          System.err.println(message);
          e.printStackTrace();
          throw new TransactionException(message);
        }
      }
   
    }
   
    String returnName = "";
    try {
//      ServletActionContext.getRequest().setAttribute("ss", injectedSessions.iterator().next().hashCode());
      returnName = invocation.invoke();
     
      for (Session hibernateSession:injectedSessions) {
        Transaction hibernateTransation = hibernateSession.getTransaction();
       
        try {
          commitHibernateTransaction(hibernateTransation);
          closeHibernateSession(hibernateSession);
          log.debug("Hibernate Transaction Committed");
        }
        catch (Exception e) {
          hibernateSession.clear();
          sbErrorMessage.append("Could not commit the Hibernate Transaction: ");
          sbErrorMessage.append(e.getMessage());
          String message = sbErrorMessage.toString();
          System.err.println(message);
          closeHibernateSession(hibernateSession);
          detectAndCloseHibernateCoreSessionCreatedLater(action);
          e.printStackTrace();
          throw new SessionInjectionException(message);
        }
   
      }

      detectAndCommitHibernateTransactionCreatedLater(action);
View Full Code Here

TOP

Related Classes of com.googlecode.s2hibernate.lang.SessionInjectionException

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.