Package org.hibernate

Examples of org.hibernate.Session.disconnect()


    assertTrue( Hibernate.isInitialized(dp) );
    Object none = s.load( DataPoint.class, new Long(666));
    assertFalse( Hibernate.isInitialized(none) );
   
    t.commit();
    s.disconnect();
   
    Object[] holder = new Object[] { s, dp, none };
   
    holder = (Object[]) SerializationHelper.clone(holder);
    Session sclone = (Session) holder[0];
View Full Code Here


    SimpleJtaTransactionManagerImpl.getInstance().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

    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();
  }

  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

            SessionFactoryUtils.toString(session) + "] after transaction");
      }
      if (txObject.getSessionHolder().getPreviousFlushMode() != null) {
        session.setFlushMode(txObject.getSessionHolder().getPreviousFlushMode());
      }
      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();
        }
        return;
      }
    }
    // We'll only get here if there was no specific JTA transaction to handle.
View Full Code Here

        session.setFlushMode(this.sessionHolder.getPreviousFlushMode());
      }
      if (this.hibernateTransactionCompletion) {
        // Eagerly disconnect the Session here, to make release mode "on_close" work nicely.
        // We know that this is appropriate if a TransactionManagerLookup has been specified.
        session.disconnect();
      }
    }
  }

  public void afterCommit() {
View Full Code Here

      // (closed in beforeCompletion in case of TransactionManagerLookup).
      if (this.newSession) {
        SessionFactoryUtils.closeSessionOrRegisterDeferredClose(session, this.sessionFactory);
      }
      else if (!this.hibernateTransactionCompletion) {
        session.disconnect();
      }
    }
    if (!this.newSession && status != STATUS_COMMITTED) {
      // Clear all pending inserts/updates/deletes in the Session.
      // Necessary for pre-bound Sessions, to avoid inconsistent state.
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

        // Running against Hibernate 3.1+...
        // Let's explicitly disconnect the Session to provide efficient Connection handling
        // even with connection release mode "on_close". The Session will automatically
        // obtain a new Connection in case of further database access.
        // Couldn't do this on Hibernate 3.0, where disconnect required a manual reconnect.
        session.disconnect();
      }
    }
    txObject.getSessionHolder().clear();
  }
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.