Package org.hibernate.classic

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


    s.getTransaction().rollback();
    s.close();

    s = openSession();
    s.beginTransaction();
    List list = s.createQuery( "from Car" ).list();
    assertEquals( "temp table gen caused premature commit", 0, list.size() );
    s.createQuery( "delete from Car" ).executeUpdate();
    s.getTransaction().rollback();
    s.close();
  }
View Full Code Here


    s = openSession();
    s.beginTransaction();
    List list = s.createQuery( "from Car" ).list();
    assertEquals( "temp table gen caused premature commit", 0, list.size() );
    s.createQuery( "delete from Car" ).executeUpdate();
    s.getTransaction().rollback();
    s.close();
  }

View Full Code Here

    Session s = openSession();
    Transaction t = s.beginTransaction();

    // currently, we need the three different binds because they are different underlying types...
    int count = s.createQuery( "update BooleanLiteralEntity set yesNoBoolean = :b1, trueFalseBoolean = :b2, zeroOneBoolean = :b3" )
        .setBoolean( "b1", true )
        .setBoolean( "b2", true )
        .setBoolean( "b3", true )
        .executeUpdate();
    assertEquals( 1, count );
View Full Code Here

        .setBoolean( "b1", true )
        .setBoolean( "b2", true )
        .setBoolean( "b3", true )
        .executeUpdate();
    assertEquals( 1, count );
    BooleanLiteralEntity entity = ( BooleanLiteralEntity ) s.createQuery( "from BooleanLiteralEntity" ).uniqueResult();
    assertTrue( entity.isYesNoBoolean() );
    assertTrue( entity.isTrueFalseBoolean() );
    assertTrue( entity.isZeroOneBoolean() );
    s.clear();
View Full Code Here

    assertTrue( entity.isYesNoBoolean() );
    assertTrue( entity.isTrueFalseBoolean() );
    assertTrue( entity.isZeroOneBoolean() );
    s.clear();

    count = s.createQuery( "update BooleanLiteralEntity set yesNoBoolean = true, trueFalseBoolean = true, zeroOneBoolean = true" )
        .executeUpdate();
    assertEquals( 1, count );
    entity = ( BooleanLiteralEntity ) s.createQuery( "from BooleanLiteralEntity" ).uniqueResult();
    assertTrue( entity.isYesNoBoolean() );
    assertTrue( entity.isTrueFalseBoolean() );
View Full Code Here

    s.clear();

    count = s.createQuery( "update BooleanLiteralEntity set yesNoBoolean = true, trueFalseBoolean = true, zeroOneBoolean = true" )
        .executeUpdate();
    assertEquals( 1, count );
    entity = ( BooleanLiteralEntity ) s.createQuery( "from BooleanLiteralEntity" ).uniqueResult();
    assertTrue( entity.isYesNoBoolean() );
    assertTrue( entity.isTrueFalseBoolean() );
    assertTrue( entity.isZeroOneBoolean() );

    t.commit();
View Full Code Here

    data.prepare();

    Session s = openSession();
    Transaction t = s.beginTransaction();

    s.createQuery( "insert into Pickup (id, vin, owner) select id, vin, owner from Car" ).executeUpdate();
   
    t.commit();
    t = s.beginTransaction();

    s.createQuery( "delete Vehicle" ).executeUpdate();
View Full Code Here

    s.createQuery( "insert into Pickup (id, vin, owner) select id, vin, owner from Car" ).executeUpdate();
   
    t.commit();
    t = s.beginTransaction();

    s.createQuery( "delete Vehicle" ).executeUpdate();
   
    t.commit();
    s.close();

    data.cleanup();
View Full Code Here

    data.prepare();

    Session s = openSession();
    Transaction t = s.beginTransaction();

    List l = s.createQuery("from Vehicle").list();
    assertEquals(l.size(),4);

    s.createSQLQuery( "insert into PICKUP (id, vin, owner) select id, vin, owner from Car" ).executeUpdate();

    l = s.createQuery("from Vehicle").list();
View Full Code Here

    List l = s.createQuery("from Vehicle").list();
    assertEquals(l.size(),4);

    s.createSQLQuery( "insert into PICKUP (id, vin, owner) select id, vin, owner from Car" ).executeUpdate();

    l = s.createQuery("from Vehicle").list();
    assertEquals(l.size(),5);

    t.commit();
    t = s.beginTransaction();
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.