Package org.hibernate

Examples of org.hibernate.Session.disconnect()


  public void paused(RequestContext context) {
    if (isPersistenceContext(context.getActiveFlow())) {
      Session session = getHibernateSession(context.getFlowExecutionContext().getActiveSession());
      unbind(session);
      session.disconnect();
    }
  }

  public void resuming(RequestContext context) {
    if (isPersistenceContext(context.getActiveFlow())) {
View Full Code Here


      }
      if (txObject.getSessionHolder().getPreviousFlushMode() != null) {
        session.setFlushMode(txObject.getSessionHolder().getPreviousFlushMode());
      }
      if (!this.hibernateManagedSession) {
        session.disconnect();
      }
    }
    txObject.getSessionHolder().clear();
  }
View Full Code Here

    Session session = HibernateUtil.getSession();
    try {
      HibernateUtil.threadSession.set( null );
      if ( session.isConnected() && session.isOpen() ) {
        session.disconnect();
      }
    } catch ( HibernateException ex ) {
      HibernateUtil.log.error( Messages.getInstance().getErrorString( "HIBUTIL.ERROR_0002_DISCONNECT" ), ex ); //$NON-NLS-1$
      throw new RepositoryException( Messages.getInstance().getErrorString( "HIBUTIL.ERROR_0002_DISCONNECT" ), ex ); //$NON-NLS-1$
    }
View Full Code Here

  public void paused(RequestContext context) {
    if (isPersistenceContext(context.getActiveFlow())) {
      Session session = getHibernateSession(context.getFlowExecutionContext().getActiveSession());
      unbind(session);
      session.disconnect();
    }
  }

  public void resuming(RequestContext context) {
    if (isPersistenceContext(context.getActiveFlow())) {
View Full Code Here

    DummyTransactionManager.INSTANCE.begin();
    Session s = getSessions().getCurrentSession();

    s.createQuery( "from Item" ).list();

    s.disconnect();
    byte[] bytes = SerializationHelper.serialize( s );
    s = ( Session ) SerializationHelper.deserialize( bytes );
    s.reconnect();

    s.createQuery( "from Item" ).list();
View Full Code Here

            throw new IllegalStateException("This SessionFactory is closed.");
         }
         if (method.getName().equals("close"))
         {
            Session session = getSession();
            session.disconnect();
            isClosed = true;
            return null;
         }

         if (method.getName().equals("getCurrentSession"))
View Full Code Here

            // In case of pre-bound Session, restore previous flush mode.
            session.setFlushMode(this.sessionHolder.getPreviousFlushMode());
        }

        // Eagerly disconnect the Session here, to make release mode "on_close" work nicely.
        session.disconnect();
    }

    public void afterCommit() {
    }
View Full Code Here

      }
      if (txObject.getSessionHolder().getPreviousFlushMode() != null) {
        session.setFlushMode(txObject.getSessionHolder().getPreviousFlushMode());
      }
      if (!this.hibernateManagedSession) {
        session.disconnect();
      }
    }
    txObject.getSessionHolder().clear();
  }
View Full Code Here

    if (this.sessionHolder.getPreviousFlushMode() != null) {
      // In case of pre-bound Session, restore previous flush mode.
      session.setFlushMode(this.sessionHolder.getPreviousFlushMode());
    }
    // Eagerly disconnect the Session here, to make release mode "on_close" work nicely.
    session.disconnect();

    // Unbind at this point if it's a new Session...
    if (this.newSession) {
      TransactionSynchronizationManager.unbindResource(this.sessionFactory);
      this.holderActive = false;
View Full Code Here

   */
  public final void testManualDisconnectedSerialization() throws Throwable {
    prepare();
    Session sessionUnderTest = getSessionUnderTest();

    sessionUnderTest.disconnect();

    SerializationHelper.serialize( sessionUnderTest );
    checkSerializedState( sessionUnderTest );

    release( sessionUnderTest );
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.