Examples of StatelessSession


Examples of org.hibernate.StatelessSession

      final boolean wrapInTransaction = wrapInTransaction();
      if ( wrapInTransaction ) {
        TransactionManager transactionManager = getTransactionManager();
        try {
          final Session session;
          final StatelessSession statelessSession;
          if ( sessionAwareRunnable != null ) {
            session = factory.openSession();
            statelessSession = null;
          }
          else {
            session = null;
            statelessSession = factory.openStatelessSession();
          }
 
          transactionManager.begin();
 
          if ( sessionAwareRunnable != null ) {
            sessionAwareRunnable.run( session );
          }
          else {
            statelessSessionAwareRunnable.run( statelessSession );
          }
 
          transactionManager.commit();
 
          if ( sessionAwareRunnable != null ) {
            session.close();
          }
          else {
            statelessSession.close();
          }
        }
        catch (Throwable e) {
          errorHandler.handleException( log.massIndexerUnexpectedErrorMessage() , e);
          try {
View Full Code Here

Examples of org.hibernate.StatelessSession

    }
    log.trace( "finished" );
  }

  private void inTransactionWrapper(StatelessSession upperSession) throws Exception {
    StatelessSession session = upperSession;
    if ( upperSession == null ) {
      session = sessionFactory.openStatelessSession();
    }
    try {
      Transaction transaction = session.getTransaction();
      transaction.begin();
      loadAllIdentifiers( session );
      transaction.commit();
    }
    catch (InterruptedException e) {
      // just quit
      Thread.currentThread().interrupt();
    }
    finally {
      if ( upperSession == null ) {
        session.close();
      }
    }
  }
View Full Code Here

Examples of org.hibernate.StatelessSession

  @Override
  public void runWithErrorHandler() throws Exception {
    if ( wrapInTransaction ) {
      final Session session;
      final StatelessSession statelessSession;
      if ( sessionAwareRunnable != null ) {
        session = batchContext.factory.openSession();
        statelessSession = null;
      }
      else {
        session = null;
        statelessSession = batchContext.factory.openStatelessSession();
      }

      batchContext.transactionManager.begin();

      if ( sessionAwareRunnable != null ) {
        sessionAwareRunnable.run( session );
      }
      else {
        statelessSessionAwareRunnable.run( statelessSession );
      }

      batchContext.transactionManager.commit();

      if ( sessionAwareRunnable != null ) {
        session.close();
      }
      else {
        statelessSession.close();
      }
    }
    else {
      if ( sessionAwareRunnable != null ) {
        sessionAwareRunnable.run( null );
View Full Code Here

Examples of org.jboss.as.test.integration.web.sso.interfaces.StatelessSession

            IOException {
        try {
            InitialContext ctx = new InitialContext();
            Context enc = (Context) ctx.lookup("java:comp/env");
            StatelessSessionHome home = (StatelessSessionHome) enc.lookup("ejb/OptimizedEJB");
            StatelessSession bean = home.create();
            bean.noop();

            Object homeRef = enc.lookup("ejb/OptimizedEJB");
            home = (StatelessSessionHome) PortableRemoteObject.narrow(homeRef, StatelessSessionHome.class);
            bean = home.create();
            bean.noop();
            bean.getData();

            StatelessSessionLocalHome localHome = (StatelessSessionLocalHome) enc.lookup("ejb/local/OptimizedEJB");
            StatelessSessionLocal localBean = localHome.create();
            localBean.noop();
        } catch (Exception e) {
View Full Code Here

Examples of org.jboss.demo.cluster.slsb.StatelessSession

 
  private void createPerson() throws NamingException {
    System.out.println();
    System.out.print( "Enter your name: " );
    String name = System.console().readLine();
    StatelessSession slsb = getStatelessSessionBean();
    String server = slsb.getServer();
    slsb.createPerson( new Person( name ) );
    System.out.println();
    System.out.println( "Created person on server " + server );
  }
View Full Code Here

Examples of org.jboss.demo.cluster.slsb.StatelessSession

 
  private void getName() throws NamingException {
    System.out.println();
    System.out.print( "Enter person Id: " );
    String id = System.console().readLine();
    StatelessSession slsb = getStatelessSessionBean();
    String name = slsb.getName( Long.valueOf( id ) );
    System.out.println( "Person name is registered as " + name + " on " + slsb.getServer() );
  }
View Full Code Here

Examples of org.jboss.demo.cluster.slsb.StatelessSession

    System.out.println();
    System.out.print( "Enter person Id: " );
    String id = System.console().readLine();
    System.out.print( "Enter new name: " );
    String name = System.console().readLine();
    StatelessSession slsb = getStatelessSessionBean();
    String server = slsb.getServer();
    slsb.replacePerson( Long.valueOf( id ), name );
    System.out.println( "Changed person name on server " + server );
  }
View Full Code Here

Examples of org.jboss.demo.cluster.slsb.StatelessSession

    slsb.replacePerson( Long.valueOf( id ), name );
    System.out.println( "Changed person name on server " + server );
  }

  private void listPersons() throws NamingException {
    StatelessSession slsb = getStatelessSessionBean();
    System.out.println( "Person objects stored in the database as received from " + slsb.getServer() + " are as follows:" );
    System.out.println(slsb.findPersons());
  }
View Full Code Here

Examples of org.jboss.demo.cluster.slsb.StatelessSession

    String message = System.console().readLine();
    System.out.print( "Number of messages: " );
    Integer messageCount = Integer.valueOf( System.console().readLine() );
    System.out.print( "Delay in Milliseconds: " );
    Long processingDelay = Long.valueOf( System.console().readLine() );
    StatelessSession slsb = getStatelessSessionBean();
    slsb.sendMessage( message, messageCount, processingDelay );
  }
View Full Code Here

Examples of org.jboss.demo.cluster.slsb.StatelessSession

 
  protected void execute() throws Exception {
    Hashtable<String, String> jndiProps = new Hashtable<String, String>();
    jndiProps.put( Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming" );
    Context context = new InitialContext( jndiProps );
    StatelessSession slsb = (StatelessSession)context.lookup(SLSB_JNDI);
    for (int i = 0; i < 10; i++){
      System.out.println(slsb.getServer());
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.