Package org.hibernate

Examples of org.hibernate.Session.disconnect()


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

    sessionUnderTest.disconnect();

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

    release( sessionUnderTest );
View Full Code Here


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

    sessionUnderTest.disconnect();

    byte[] bytes = SerializationHelper.serialize( sessionUnderTest );
    checkSerializedState( sessionUnderTest );
    Session s2 = ( Session ) SerializationHelper.deserialize( bytes );
    checkDeserializedState( s2 );
View Full Code Here

    Session s2 = ( Session ) SerializationHelper.deserialize( bytes );
    checkDeserializedState( s2 );

    reconnect( s2 );

    s2.disconnect();
    reconnect( s2 );

    release( sessionUnderTest );
    release( s2 );
    done();
View Full Code Here

    sessionUnderTest.save( silly );
    sessionUnderTest.flush();

    sessionUnderTest.createQuery( "from Silly" ).iterate();

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

    reconnect( sessionUnderTest );
    sessionUnderTest.createQuery( "from Silly" ).scroll();
View Full Code Here

    checkSerializedState( sessionUnderTest );

    reconnect( sessionUnderTest );
    sessionUnderTest.createQuery( "from Silly" ).scroll();

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

    reconnect( sessionUnderTest );
    sessionUnderTest.delete( silly );
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

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

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.