Package org.hibernate.classic

Examples of org.hibernate.classic.Session.disconnect()


                sessionControl.reset();
                session.getFlushMode();
                sessionControl.setReturnValue(FlushMode.AUTO, 1);
                session.flush();
                sessionControl.setVoidCallable(1);
                session.disconnect();
                sessionControl.setReturnValue(null, 1);
                session.clear();
                sessionControl.setVoidCallable(1);
                sessionControl.replay();
              }
View Full Code Here


    sf.openSession();
    sfControl.setReturnValue(session1, 1);
    session1.getSessionFactory();
    session1Control.setReturnValue(sf, 1);
    session1.disconnect();
    session1Control.setReturnValue(null, 1);
    session1.close();
    session1Control.setReturnValue(null, 1);

    utControl.replay();
View Full Code Here

      sessionControl.setVoidCallable(1);
      if (flushNever) {
        session.setFlushMode(FlushMode.NEVER);
        sessionControl.setVoidCallable(1);
      }
      session.disconnect();
      sessionControl.setReturnValue(null, 1);
      sessionControl.replay();

      Synchronization synchronization = transaction.getSynchronization();
      assertTrue("JTA synchronization registered", synchronization != null);
View Full Code Here

    }
    Object[] result = (Object[]) q.uniqueResult();
    Object b = result[0];
    assertTrue( s.getCurrentLockMode(b)==LockMode.WRITE && s.getCurrentLockMode( result[1] )==LockMode.WRITE );
    tx.commit();
    s.disconnect();

    s.reconnect();
    tx = s.beginTransaction();
    assertTrue( s.getCurrentLockMode(b)==LockMode.NONE );
    s.createQuery( "from Foo foo" ).list();
View Full Code Here

    q.setLockMode("foo", LockMode.READ);
    q.list();
    assertTrue( s.getCurrentLockMode(b)==LockMode.READ);
    s.evict(baz);
    tx.commit();
    s.disconnect();
   
    s.reconnect();
    tx = s.beginTransaction();
    assertTrue( s.getCurrentLockMode(b)==LockMode.NONE );
    s.delete( s.load( Baz.class, baz.getCode() ) );
View Full Code Here

     s = openSession();
     s.setFlushMode(FlushMode.MANUAL);
    t = s.beginTransaction();
    Foo foo = (Foo) s.get(Foo.class, id);
    t.commit();
    s.disconnect();

    s.reconnect();
    t = s.beginTransaction();
    s.flush();
    t.commit();
View Full Code Here

    while ( iter.hasNext() ) {
      iter.next();
      iter.remove();
    }
    s.getTransaction().commit();
    s.disconnect();
    SerializationHelper.deserialize( SerializationHelper.serialize(s) );
    s.close();
  }

  public void testCache() throws Exception {
View Full Code Here

    dcp.configure( Environment.getProperties() );
    Session s = getSessions().openSession( dcp.getConnection() );
    Transaction tx = s.beginTransaction();
    s.createQuery( "from Fo" ).list();
    tx.commit();
    Connection c = s.disconnect();
    assertTrue( c!=null );
    s.reconnect(c);
    tx = s.beginTransaction();
    s.createQuery( "from Fo" ).list();
    tx.commit();
View Full Code Here

    s.save(foo);
    s.save(foo2);
    foo2.setFoo(foo);
    s.getTransaction().commit();

    s.disconnect();
    s.reconnect();

    s.beginTransaction();
    s.delete(foo);
    foo2.setFoo(null);
View Full Code Here

    s.beginTransaction();
    s.delete(foo);
    foo2.setFoo(null);
    s.getTransaction().commit();

    s.disconnect();
    s.reconnect();

    s.beginTransaction();
    s.delete(foo2);
    s.getTransaction().commit();
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.