Package org.hibernate.classic

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


    assertTrue( s.getCurrentLockMode(s3)==LockMode.NONE );
    assertTrue( s.getCurrentLockMode(s1)==LockMode.NONE );
    assertTrue( s.getCurrentLockMode(s2)==LockMode.NONE );
    assertTrue( s.getCurrentLockMode(s4)==LockMode.NONE );

    s.lock(s1, LockMode.READ); //upgrade
    assertTrue( s.getCurrentLockMode(s1)==LockMode.READ );
    s.lock(s2, LockMode.UPGRADE); //upgrade
    assertTrue( s.getCurrentLockMode(s2)==LockMode.UPGRADE );
    s.lock(s3, LockMode.UPGRADE_NOWAIT); //upgrade
    assertTrue( s.getCurrentLockMode(s3)==LockMode.UPGRADE_NOWAIT );
View Full Code Here


    assertTrue( s.getCurrentLockMode(s2)==LockMode.NONE );
    assertTrue( s.getCurrentLockMode(s4)==LockMode.NONE );

    s.lock(s1, LockMode.READ); //upgrade
    assertTrue( s.getCurrentLockMode(s1)==LockMode.READ );
    s.lock(s2, LockMode.UPGRADE); //upgrade
    assertTrue( s.getCurrentLockMode(s2)==LockMode.UPGRADE );
    s.lock(s3, LockMode.UPGRADE_NOWAIT); //upgrade
    assertTrue( s.getCurrentLockMode(s3)==LockMode.UPGRADE_NOWAIT );
    s.lock(s4, LockMode.NONE);
    assertTrue( s.getCurrentLockMode(s4)==LockMode.NONE );
View Full Code Here

    s.lock(s1, LockMode.READ); //upgrade
    assertTrue( s.getCurrentLockMode(s1)==LockMode.READ );
    s.lock(s2, LockMode.UPGRADE); //upgrade
    assertTrue( s.getCurrentLockMode(s2)==LockMode.UPGRADE );
    s.lock(s3, LockMode.UPGRADE_NOWAIT); //upgrade
    assertTrue( s.getCurrentLockMode(s3)==LockMode.UPGRADE_NOWAIT );
    s.lock(s4, LockMode.NONE);
    assertTrue( s.getCurrentLockMode(s4)==LockMode.NONE );

    s4.setName("s4");
View Full Code Here

    assertTrue( s.getCurrentLockMode(s1)==LockMode.READ );
    s.lock(s2, LockMode.UPGRADE); //upgrade
    assertTrue( s.getCurrentLockMode(s2)==LockMode.UPGRADE );
    s.lock(s3, LockMode.UPGRADE_NOWAIT); //upgrade
    assertTrue( s.getCurrentLockMode(s3)==LockMode.UPGRADE_NOWAIT );
    s.lock(s4, LockMode.NONE);
    assertTrue( s.getCurrentLockMode(s4)==LockMode.NONE );

    s4.setName("s4");
    s.flush();
    assertTrue( s.getCurrentLockMode(s4)==LockMode.WRITE );
View Full Code Here

    getSessions().evict(Glarch.class);

    s = openSession();
    txn = s.beginTransaction();
    g = (GlarchProxy) s.load( Glarch.class, gid );
    s.lock(g, LockMode.UPGRADE);
    g2 = (GlarchProxy) s.load( Glarch.class, g2id );
    assertTrue( "version", g.getVersion()==1 );
    assertTrue( "version", g.getDerivedVersion()==1 );
    assertTrue( "version", g2.getVersion()==0 );
    g.setName("foo");
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.