Package org.hibernate.classic

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


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

    s = openSession();
    t = s.beginTransaction();
    c = (Child) s.load( Child.class, new Long( c.getId() ) );
    p = c.getParent();
    assertTrue( "1-1 parent", p!=null );
    c.setCount(32);
    p.setCount(66);
    t.commit();
View Full Code Here


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

    s = openSession();
    t = s.beginTransaction();
    c = (Child) s.load( Child.class, new Long( c.getId() ) );
    p = c.getParent();
    assertTrue( "1-1 update", p.getCount()==66 );
    assertTrue( "1-1 update", c.getCount()==32 );
    assertTrue(
      "1-1 query",
View Full Code Here

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

    s = openSession();
    t = s.beginTransaction();
    p = (Parent) s.load( Parent.class, new Long( p.getId() ) );
    assertTrue( p.getChild()==null );
    p.setCount(66);
    t.commit();
    s.close();
View Full Code Here

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

    s = openSession();
    t = s.beginTransaction();
    p = (Parent) s.load( Parent.class, new Long( p.getId() ) );
    assertTrue( "null 1-1 update", p.getCount()==66 );
    assertTrue( p.getChild()==null );
    s.delete(p);
    t.commit();
    s.close();
View Full Code Here

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

    s = openSession();
    t = s.beginTransaction();
    c = (Container) s.load(Container.class, cid);
    assertTrue( c.getBag().size()==1 );
    assertTrue( c.getManyToMany().size()==2 );
    c1 = (Contained) c.getBag().iterator().next();
    assertTrue( c.getBag().size()==1 );
    c.getBag().remove(c1);
View Full Code Here

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

    s = openSession();
    t = s.beginTransaction();
    c = (Container) s.load(Container.class, cid);
    assertTrue( c.getBag().size()==0 );
    assertTrue( c.getManyToMany().size()==1 );
    c1 = (Contained) s.load( Contained.class, new Long(c1.getId()) );
    assertTrue( c1.getBag().size()==0 );
    assertEquals( 1, doDelete( s, "from ContainerX c" ) );
View Full Code Here

    s = openSession();
    t = s.beginTransaction();
    c = (Container) s.load(Container.class, cid);
    assertTrue( c.getBag().size()==0 );
    assertTrue( c.getManyToMany().size()==1 );
    c1 = (Contained) s.load( Contained.class, new Long(c1.getId()) );
    assertTrue( c1.getBag().size()==0 );
    assertEquals( 1, doDelete( s, "from ContainerX c" ) );
    assertEquals( 1, doDelete( s, "from Contained" ) );
    assertEquals( 2, doDelete( s, "from Simple" ) );
    t.commit();
View Full Code Here

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

    s = openSession();
    t = s.beginTransaction();
    c = (Container) s.load( Container.class, new Long( c.getId() ) );
    System.out.println( c.getOneToMany() );
    System.out.println( c.getManyToMany() );
    System.out.println( c.getComponents() );
    System.out.println( c.getComposites() );
    ccic = (Container.ContainerInnerClass) c.getComponents().get(2);
View Full Code Here

    c.getManyToMany().set( 0, c.getManyToMany().get(2) );
    Container.ContainerInnerClass ccic2 = new Container.ContainerInnerClass();
    ccic2.setName("foo");
    ccic2.setOne(one);
    ccic2.setMany(many);
    ccic2.setSimple( (Simple) s.load(Simple.class, new Long(0) ) );
    c.getComposites().add(ccic2);
    t.commit();
    s.close();

    s = openSession();
View Full Code Here

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

    s = openSession();
    t = s.beginTransaction();
    c = (Container) s.load( Container.class, new Long( c.getId() ) );
    System.out.println( c.getOneToMany() );
    System.out.println( c.getManyToMany() );
    System.out.println( c.getComponents() );
    System.out.println( c.getComposites() );
    assertTrue( c.getComponents().size()==1 ); //WAS: 2
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.