Package org.hibernate

Examples of org.hibernate.Session.disconnect()


   */
  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

        final HibernateTemplate template = new HibernateTemplate(sessionFactory);
        final Session session = template.getSessionFactory().openSession();
        final Set<String> alreadyReindexed = new HashSet<String>();
        final List<Entry> entryList = map.get(obj.getClass());
        reindexDependents(template, session, obj, entryList, alreadyReindexed);
        session.disconnect();
        final int size = alreadyReindexed.size();
        if (size >= 10) {
          log.info("Re-indexing of " + size + " objects done after updating " + obj.getClass().getName() + ":" + obj.getId());
        }
      }
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 afterCompletion(int status) {
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

            SessionFactoryUtils.toString(session) + "] after transaction");
      }
      if (txObject.getSessionHolder().getPreviousFlushMode() != null) {
        session.setFlushMode(txObject.getSessionHolder().getPreviousFlushMode());
      }
      session.disconnect();
    }
    txObject.getSessionHolder().clear();
  }

  /**
 
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

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.