Package org.hibernate.classic

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


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

    s = openSession();
    m = (Master) s.load(Master.class, mid);
    s.connection().commit();
    s.close();
    m.setName("New Name");
    s = openSession();
    s.update(m, mid);
View Full Code Here


    txn.commit();
    s.close();

    s = openSession();
    txn = s.beginTransaction();
    m = (Master) s.load( Master.class, mid );
    assertTrue( ( (Detail) m.getMoreDetails().iterator().next() ).getSubDetails().size()!=0 );
    s.delete(m);
    assertTrue( s.createQuery( "from SubDetail" ).list().size()==0 );
    assertTrue( s.createQuery( "from Detail d" ).list().size()==0 );
    s.delete( s.load(Master.class, m0id) );
View Full Code Here

    m = (Master) s.load( Master.class, mid );
    assertTrue( ( (Detail) m.getMoreDetails().iterator().next() ).getSubDetails().size()!=0 );
    s.delete(m);
    assertTrue( s.createQuery( "from SubDetail" ).list().size()==0 );
    assertTrue( s.createQuery( "from Detail d" ).list().size()==0 );
    s.delete( s.load(Master.class, m0id) );
    txn.commit();
    s.close();
  }

  public void testMixNativeAssigned() throws Exception {
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 );
    List list2 = c.getSubcategories();
    t.commit();
    s.close();

    assertTrue( !Hibernate.isInitialized( c.getSubcategories() ) );
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

    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();

    s = openSession();
View Full Code Here

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

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

    s = openSession();
View Full Code Here

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

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

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

  public void testCollectionReplace() throws Exception {
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 );
    c.setSubcategories(list);
    t.commit();
    s.close();

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