Package org.hibernate.classic

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


    t.commit();
    s.close();

    s = openSession();
    t = s.beginTransaction();
    c = (Category) s.load( Category.class, new Long( c.getId() ), LockMode.UPGRADE );
    List list2 = c.getSubcategories();
    t.commit();
    s.close();

    assertTrue( !Hibernate.isInitialized( c.getSubcategories() ) );
View Full Code Here


    assertTrue( !Hibernate.isInitialized( c.getSubcategories() ) );

    s = openSession();
    t = s.beginTransaction();
    c = (Category) s.load( Category.class, new Long( c.getId() ), LockMode.UPGRADE );
    c.setSubcategories(list2);
    t.commit();
    s.close();

    s = openSession();
View Full Code Here

    t.commit();
    s.close();

    s = openSession();
    t = s.beginTransaction();
    c = (Category) s.load( Category.class, new Long( c.getId() ), LockMode.UPGRADE );
    assertTrue( c.getSubcategories().size()==1 );
    s.delete(c);
    t.commit();
    s.close();
  }
View Full Code Here

    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 );
    s.flush();
View Full Code Here

    s.flush();
    tx.commit();
    s.close();

    s = openSession();
    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);
View Full Code Here

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


    s = openSession();
    c = (Category) s.load( Category.class, new Long( c.getId() ) );
    System.out.println( c.getSubcategories() );
    assertTrue( c.getSubcategories().get(0)!=null && c.getSubcategories().get(1)!=null );
    List list = ( (Category) c.getSubcategories().get(1) ).getSubcategories();
    assertTrue( list.get(1)!=null && list.get(0)==null );
View Full Code Here

    assertTrue( id!=null );
    t.commit();
    s.close();
    s = openSession();
    t = s.beginTransaction();
    po = (Po) s.load(Po.class, id);
    assertTrue( po.getSet().size()==2 );
    assertTrue( po.getList().size()==1 );
    s.delete(po);
    assertTrue( s.createQuery( "from Top" ).list().size()==0 );
    t.commit();
View Full Code Here

    s.getTransaction().commit();
    s.close();

    s = openSession();
    s.beginTransaction();
    s.load(Lower.class, id);
    s.getTransaction().commit();
    s.close();

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

    s.getTransaction().commit();
    s.close();

    s = openSession();
    s.beginTransaction();
    s.delete( s.load(Lower.class, id) );
    s.getTransaction().commit();
    s.close();
  }

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

    sess.getTransaction().commit();
    sess.close();

    sess = openSession();
    sess.beginTransaction();
    ls = (Lower) sess.load(Lower.class, id);
    assertTrue( ls.getBag().size()==1 );
    doDelete( sess, "from java.lang.Object" );
    sess.getTransaction().commit();
    sess.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.