@Test
  public void testTempTableGenerationIsolation() throws Throwable {
    Session s = openSession();
    s.beginTransaction();

    Truck truck = new Truck();
    truck.setVin("123t");
    truck.setOwner("Steve");
    s.save(truck);

    // manually flush the session to ensure the insert happens
    s.flush();

    // now issue a bulk delete against Car which should force the temp table to be
    // created.  we need to test to ensure that this does not cause the transaction
    // to be committed...
    s.createQuery("delete from Vehicle").executeUpdate();

    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();
  }
    private void prepare() {
      Session s = openSession();
      Transaction txn = s.beginTransaction();

      polliwog = new Animal();
      polliwog.setBodyWeight(12);
      polliwog.setDescription("Polliwog");

      catepillar = new Animal();
      catepillar.setBodyWeight(10);
      catepillar.setDescription("Catepillar");

      frog = new Animal();
      frog.setBodyWeight(34);
      frog.setDescription("Frog");

      polliwog.setFather(frog);
      frog.addOffspring(polliwog);

      butterfly = new Animal();
      butterfly.setBodyWeight(9);
      butterfly.setDescription("Butterfly");

      catepillar.setMother(butterfly);
      butterfly.addOffspring(catepillar);

      s.save(frog);
      s.save(polliwog);
      s.save(butterfly);
      s.save(catepillar);

      Dog dog = new Dog();
      dog.setBodyWeight(200);
      dog.setDescription("dog");
      s.save(dog);

      Cat cat = new Cat();
      cat.setBodyWeight(100);
      cat.setDescription("cat");
      s.save(cat);

      zoo = new Zoo();
      zoo.setName("Zoo");
      Address add = new Address();
      add.setCity("MEL");
      add.setCountry("AU");
      add.setStreet("Main st");
      add.setPostalCode("3000");
      zoo.setAddress(add);

      pettingZoo = new PettingZoo();
      pettingZoo.setName("Petting Zoo");
      Address addr = new Address();
      addr.setCity("Sydney");
      addr.setCountry("AU");
      addr.setStreet("High st");
      addr.setPostalCode("2000");
      pettingZoo.setAddress(addr);

      s.save(zoo);
      s.save(pettingZoo);

      Joiner joiner = new Joiner();
      joiner.setJoinedName("joined-name");
      joiner.setName("name");
      s.save(joiner);

      Car car = new Car();
      car.setVin("123c");
      car.setOwner("Kirsten");
      s.save(car);

      Truck truck = new Truck();
      truck.setVin("123t");
      truck.setOwner("Steve");
      s.save(truck);

      SUV suv = new SUV();
      suv.setVin("123s");
      suv.setOwner("Joe");
      s.save(suv);

      Pickup pickup = new Pickup();
      pickup.setVin("123p");
      pickup.setOwner("Cecelia");
      s.save(pickup);

      BooleanLiteralEntity bool = new BooleanLiteralEntity();
      s.save(bool);

      txn.commit();
      s.close();
    }