Package org.hibernate.classic

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


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

    s = openSession();
    t = s.beginTransaction();
    multi = (Multi) s.load( Top.class, multiId );
    simp = (Top) s.load( Top.class, simpId );
    assertTrue( ! (simp instanceof Multi) );
    assertTrue( multi.getExtraProp().equals("extra23") );
    //multi.setCount( multi.getCount() + 1 );
    assertTrue( multi.getName().equals("newer name") );
View Full Code Here


    s.close();

    s = openSession();
    t = s.beginTransaction();
    multi = (Multi) s.load( Top.class, multiId );
    simp = (Top) s.load( Top.class, simpId );
    assertTrue( ! (simp instanceof Multi) );
    assertTrue( multi.getExtraProp().equals("extra23") );
    //multi.setCount( multi.getCount() + 1 );
    assertTrue( multi.getName().equals("newer name") );
    t.commit();
View Full Code Here

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

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

    s.close();

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

    s.close();
    assertTrue( ls.getOther()==ls && ls.getAnother()==ls && ls.getYetanother()==ls );

    s = openSession();
    t = s.beginTransaction();
    ls = (Lower) s.load(Lower.class, id);
    assertTrue( ls.getOther()==ls && ls.getAnother()==ls && ls.getYetanother()==ls );
    assertTrue( ls.getSet().size()==2 );
    Iterator iter = ls.getSet().iterator();
    int foundMulti = 0;
    int foundSimple = 0;
View Full Code Here

    s.close();
    assertTrue( ls.getOther()==ls && ls.getAnother()==multi && ls.getYetanother()==ls );

    s = openSession();
    t = s.beginTransaction();
    ls = (Lower) s.load(Lower.class, id);
    assertTrue( ls.getOther()==ls && ls.getYetanother()==ls );
    assertTrue( ls.getAnother().getName().equals("name") && ls.getAnother() instanceof Multi );
    s.delete(ls);
    s.delete( ls.getAnother() );
    t.commit();
View Full Code Here

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

    s = openSession();
    s.beginTransaction();
    baz = (Baz) s.load(Baz.class, id);
    assertTrue( baz.getStringList().size()==3 && baz.getStringList().contains("bar") );
    s.delete(baz);
    s.getTransaction().commit();
    s.close();
View Full Code Here

    foo = (Foo) SerializationHelper.deserialize( SerializationHelper.serialize(foo) );

    s = openSession();
    s.beginTransaction();
    FooProxy foo2 = (FooProxy) s.load( Foo.class, foo.getKey() );
    foo2.setString("dirty");
    foo2.setBoolean( new Boolean(false) );
    foo2.setBytes( new byte[] { 1,2,3} );
    foo2.setDate(null);
    foo2.setShort( new Short("69") );
View Full Code Here

    s.close();

    s = openSession();
    s.beginTransaction();
    Foo foo3 = new Foo();
    s.load( foo3, foo.getKey() );
    // There is an interbase bug that causes null integers to return as 0, also numeric precision is <= 15
    assertTrue( "update", foo2.equalsFoo(foo3) );
    s.delete(foo3);
    doDelete( s, "from Glarch" );
    s.getTransaction().commit();
View Full Code Here

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

    s = openSession();
    s.beginTransaction();
    baz = (Baz) s.load( Baz.class, baz.getCode() );
    Object bag = baz.getFooBag();
    assertFalse( Hibernate.isInitialized(bag) );
    s.createQuery( "from Baz baz left join fetch baz.fooBag" ).list();
    assertTrue( Hibernate.isInitialized(bag) );
    assertTrue( bag==baz.getFooBag() );
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.