Package org.hibernate.classic

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


    int count = s.createQuery( "update versioned IntegerVersioned set name = name" ).executeUpdate();
    assertEquals( "incorrect exec count", 1, count );
    t.commit();

    t = s.beginTransaction();
    entity = ( IntegerVersioned ) s.load( IntegerVersioned.class, entity.getId() );
    assertEquals( "version not incremented", initialVersion + 1, entity.getVersion() );

    s.delete( entity );
    t.commit();
    s.close();
View Full Code Here


    int count = s.createQuery( "update versioned TimestampVersioned set name = name" ).executeUpdate();
    assertEquals( "incorrect exec count", 1, count );
    t.commit();

    t = s.beginTransaction();
    entity = ( TimestampVersioned ) s.load( TimestampVersioned.class, entity.getId() );
    assertTrue( "version not incremented", entity.getVersion().after( initialVersion ) );

    s.delete( entity );
    t.commit();
    s.close();
View Full Code Here

        .setString( "desc", data.polliwog.getDescription() )
        .setString( "newDesc", "Tadpole" )
        .executeUpdate();
    assertEquals( "Incorrect entity-updated count", 1, count );

    Animal tadpole = ( Animal ) s.load( Animal.class, data.polliwog.getId() );
    assertEquals( "Update did not take effect", "Tadpole", tadpole.getDescription() );

    count = s.createQuery( "update Animal set bodyWeight = bodyWeight + :w1 + :w2" )
        .setDouble( "w1", 1 )
        .setDouble( "w2", 2 )
View Full Code Here

    int count = s.createQuery( "update versioned IntegerVersioned set name = name" ).executeUpdate();
    assertEquals( "incorrect exec count", 1, count );
    t.commit();

    t = s.beginTransaction();
    entity = ( IntegerVersioned ) s.load( IntegerVersioned.class, entity.getId() );
    assertEquals( "version not incremented", initialVersion + 1, entity.getVersion() );

    s.delete( entity );
    t.commit();
    s.close();
View Full Code Here

    int count = s.createQuery( "update versioned TimestampVersioned set name = name" ).executeUpdate();
    assertEquals( "incorrect exec count", 1, count );
    t.commit();

    t = s.beginTransaction();
    entity = ( TimestampVersioned ) s.load( TimestampVersioned.class, entity.getId() );
    assertTrue( "version not incremented", entity.getVersion().after( initialVersion ) );

    s.delete( entity );
    t.commit();
    s.close();
View Full Code Here

        .setString( "desc", data.polliwog.getDescription() )
        .setString( "newDesc", "Tadpole" )
        .executeUpdate();
    assertEquals( "Incorrect entity-updated count", 1, count );

    Animal tadpole = ( Animal ) s.load( Animal.class, data.polliwog.getId() );
    assertEquals( "Update did not take effect", "Tadpole", tadpole.getDescription() );

    count = s.createQuery( "update Animal set bodyWeight = bodyWeight + :w1 + :w2" )
        .setDouble( "w1", 1 )
        .setDouble( "w2", 2 )
View Full Code Here

    Serializable id = s.save(c);
    s.flush();
    s.connection().commit();
    s.close();
    s = openSession();
    c = (Category) s.load(Category.class, id);
    s.refresh(c);
    s.flush();
    assertTrue( c.getSubcategories().size()==1 );
    s.flush();
    s.connection().commit();
View Full Code Here

    assertTrue( c.getSubcategories().size()==1 );
    s.flush();
    s.connection().commit();
    s.close();
    s = openSession();
    c = (Category) s.load(Category.class, id);
    assertTrue( c.getSubcategories().size()==1 );
    s.delete(c);
    s.flush();
    s.connection().commit();
    s.close();
View Full Code Here

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

    s = openSession();
    c = (Category) s.load(Category.class, id);
    c.getSubcategories().size(); //force load and cache
    s.connection().commit();
    s.close();
   
    s = openSession();
View Full Code Here

   
    s = openSession();
    if ( (getDialect() instanceof MySQLDialect) ) {
      s.connection().setTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED);
    }
    c = (Category) s.load(Category.class, id);
    c.getSubcategories().size(); //force load

    Session ss = openSession();
    Category c2 = (Category) ss.load(Category.class, id);
    ss.delete( c2.getSubcategories().get(0) );
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.