Package org.hibernate.classic

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


    catch( QueryException e ) {
      // expected result
    }

    t.commit();
    t = s.beginTransaction();

    s.createQuery( "delete Vehicle" ).executeUpdate();

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


  public void testInsertIntoSuperclassPropertiesFails() {
    TestData data = new TestData();
    data.prepare();

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

    try {
      s.createQuery( "insert into Human (id, bodyWeight) select id, bodyWeight from Lizard" ).executeUpdate();
      fail( "superclass prop insertion did not error" );
    }
View Full Code Here

    catch( QueryException e ) {
      // expected result
    }

    t.commit();
    t = s.beginTransaction();

    s.createQuery( "delete Animal where mother is not null" ).executeUpdate();
    s.createQuery( "delete Animal where father is not null" ).executeUpdate();
    s.createQuery( "delete Animal" ).executeUpdate();
View Full Code Here

  public void testInsertAcrossMappedJoinFails() {
    TestData data = new TestData();
    data.prepare();

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

    try {
      s.createQuery( "insert into Joiner (name, joinedName) select vin, owner from Car" ).executeUpdate();
      fail( "mapped-join insertion did not error" );
    }
View Full Code Here

    catch( QueryException e ) {
      // expected result
    }

    t.commit();
    t = s.beginTransaction();

    s.createQuery( "delete Joiner" ).executeUpdate();
    s.createQuery( "delete Vehicle" ).executeUpdate();

    t.commit();
View Full Code Here

    // create a Zoo
    Zoo zoo = new Zoo();
    zoo.setName( "zoo" );

    Session s = openSession();
    Transaction t = s.beginTransaction();
    s.save( zoo );
    t.commit();
    s.close();

    s = openSession();
View Full Code Here

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

    s = openSession();
    t = s.beginTransaction();
    int count = s.createQuery( "insert into PettingZoo (name) select name from Zoo" ).executeUpdate();
    t.commit();
    s.close();

    assertEquals( "unexpected insertion count", 1, count );
View Full Code Here

    s.close();

    assertEquals( "unexpected insertion count", 1, count );

    s = openSession();
    t = s.beginTransaction();
    PettingZoo pz = ( PettingZoo ) s.createQuery( "from PettingZoo" ).uniqueResult();
    t.commit();
    s.close();

    assertEquals( zoo.getName(), pz.getName() );
View Full Code Here

    assertEquals( zoo.getName(), pz.getName() );
    assertTrue( zoo.getId() != pz.getId() );

    s = openSession();
    t = s.beginTransaction();
    s.createQuery( "delete Zoo" ).executeUpdate();
    t.commit();
    s.close();
  }
View Full Code Here

    if ( !HqlSqlWalker.supportsIdGenWithBulkInsertion( generator ) ) {
      return;
    }

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

    IntegerVersioned entity = new IntegerVersioned( "int-vers" );
    s.save( entity );
    s.createQuery( "select id, name, version from IntegerVersioned" ).list();
    t.commit();
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.