Package org.hibernate.classic

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


    s = openSession();
    list = s.find("from Fum fum where not fum.fum='FRIEND'");
    assertTrue( "deleted owner", list.size()==2 );
    s.lock( list.get(0), LockMode.UPGRADE );
    s.lock( list.get(1), LockMode.UPGRADE );
    Iterator iter = list.iterator();
    while ( iter.hasNext() ) {
      s.delete( iter.next() );
    }
    s.flush();
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

    s.connection().commit();
    s.close();

    s = openSession();
    Transaction tx = s.beginTransaction();
    s.lock(c, LockMode.UPGRADE);
    Category loaded = (Category) s.load( Category.class, new Long( c3.getId() ) );
    assertTrue( s.contains(c3) );
    assertTrue(loaded==c3);
    assertTrue( s.getCurrentLockMode(c3)==LockMode.NONE );
    assertTrue( s.getCurrentLockMode(c)==LockMode.UPGRADE );
View Full Code Here

    loaded = (Category) s.load( Category.class, new Long( c.getId() ) );
    assertFalse( Hibernate.isInitialized( loaded.getSubcategories() ) );
    s.connection().commit();
    s.close();
    s = openSession();
    s.lock(loaded, LockMode.NONE);
    assertTrue( loaded.getSubcategories().size()==2 );
    s.connection().commit();
    s.close();

View Full Code Here

    s = openSession();
    t = s.beginTransaction();
    multi = (Multi) s.load(Top.class, mid, LockMode.UPGRADE);
    simp = (Top) s.load(Top.class, sid);
    s.lock(simp, LockMode.UPGRADE_NOWAIT);
    t.commit();
    s.close();

    s = openSession();
    t = s.beginTransaction();
View Full Code Here

    s = openSession();
    t = s.beginTransaction();
    multi = (Multi) s.load( Top.class, multiId, LockMode.UPGRADE );
    simp = (Top) s.load( Top.class, simpId );
    s.lock(simp, LockMode.UPGRADE_NOWAIT);
    t.commit();
    s.close();

    s = openSession();
    t = s.beginTransaction();
View Full Code Here

    s.connection().commit();
    s.close();

    s = openSession();
    Transaction tx = s.beginTransaction();
    s.lock(c, LockMode.UPGRADE);
    Category loaded = (Category) s.load( Category.class, new Long( c3.getId() ) );
    assertTrue( s.contains(c3) );
    assertTrue(loaded==c3);
    assertTrue( s.getCurrentLockMode(c3)==LockMode.NONE );
    assertTrue( s.getCurrentLockMode(c)==LockMode.UPGRADE );
View Full Code Here

    loaded = (Category) s.load( Category.class, new Long( c.getId() ) );
    assertFalse( Hibernate.isInitialized( loaded.getSubcategories() ) );
    s.connection().commit();
    s.close();
    s = openSession();
    s.lock(loaded, LockMode.NONE);
    assertTrue( loaded.getSubcategories().size()==2 );
    s.connection().commit();
    s.close();

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

    s = openSession();
    t = s.beginTransaction();
    multi = (Multi) s.load(Top.class, mid, LockMode.UPGRADE);
    simp = (Top) s.load(Top.class, sid);
    s.lock(simp, LockMode.UPGRADE_NOWAIT);
    t.commit();
    s.close();

    s = openSession();
    t = s.beginTransaction();
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.