Package org.hibernate.classic

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


    s.save(foo);
    s.save(foo2);
    foo2.setFoo(foo);
    s.flush();
    s.connection().commit();
    s.disconnect();
    s.reconnect();
    s.delete(foo);
    foo2.setFoo(null);
    s.flush();
    s.connection().commit();
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.find("from Foo foo");
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

    simple.setName("My UnflushedSessionSerialization Simple");
    simple.setPay( new Float(5000) );
    s.save( simple, new Long(10) );

    // Now, try to serialize session without flushing...
    s.disconnect();
    Session s2 = spoofSerialization(s);
    s.close();
    s = s2;
    s.reconnect();
View Full Code Here

    s2.load( Qux.class, new Long(666) ); //nonexistent

    assertTrue( s2.delete("from Glarch g")==1 );
    txn2.commit();

    s2.disconnect();

    Session s3 = (Session) SerializationHelper.deserialize( SerializationHelper.serialize(s2) );
    s2.close();
    //s3.reconnect();
    assertTrue( s3.load( Qux.class, new Long(666) )!=null ); //nonexistent
View Full Code Here

    s2.load( Qux.class, new Long(666) ); //nonexistent

    assertTrue( s2.delete("from Glarch g")==1 );
    txn2.commit();

    s2.disconnect();

    Session s3 = (Session) SerializationHelper.deserialize( SerializationHelper.serialize(s2) );
    s2.close();
    //s3.reconnect();
    assertTrue( s3.load( Qux.class, new Long(666) )!=null ); //nonexistent
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.find("from Foo foo");
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.save(foo);
    s.save(foo2);
    foo2.setFoo(foo);
    s.flush();
    s.connection().commit();
    s.disconnect();
    s.reconnect();
    s.delete(foo);
    foo2.setFoo(null);
    s.flush();
    s.connection().commit();
View Full Code Here

    s.reconnect();
    s.delete(foo);
    foo2.setFoo(null);
    s.flush();
    s.connection().commit();
    s.disconnect();
    s.reconnect();
    s.delete(foo2);
    s.flush();
    s.connection().commit();
    s.close();
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.