protected boolean readCommittedIsolationMaintained(String scenario) {
   int isolation = java.sql.Connection.TRANSACTION_READ_UNCOMMITTED;
   Session testSession = null;
   try {
     testSession = openSession();
     isolation =
         testSession.doReturningWork(
             new AbstractReturningWork<Integer>() {
               @Override
               public Integer execute(Connection connection) throws SQLException {
                 return connection.getTransactionIsolation();
               }
             });
   } catch (Throwable ignore) {
   } finally {
     if (testSession != null) {
       try {
         testSession.close();
       } catch (Throwable ignore) {
       }
     }
   }
   if (isolation < java.sql.Connection.TRANSACTION_READ_COMMITTED) {
     SkipLog.reportSkip(
         "environment does not support at least read committed isolation", scenario);
     return false;
   } else {
     return true;
   }
 }
  @Test
  @SuppressWarnings({"UnnecessaryUnboxing"})
  @RequiresDialectFeature(
      value = DialectChecks.SupportsParametersInInsertSelectCheck.class,
      comment = "dialect does not support parameter in INSERT ... SELECT")
  public void testInsertWithGeneratedTimestampVersion() {
    // Make sure the env supports bulk inserts with generated ids...
    if (!supportsBulkInsertIdGeneration(TimestampVersioned.class)) {
      SkipLog.reportSkip(
          "bulk id generation not supported",
          "test bulk inserts with generated id and generated timestamp");
      return;
    }

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

    TimestampVersioned entity = new TimestampVersioned("int-vers");
    s.save(entity);
    s.createQuery("select id, name, version from TimestampVersioned").list();
    t.commit();
    s.close();

    Long initialId = entity.getId();
    // Date initialVersion = entity.getVersion();

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

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

    s = openSession();
    t = s.beginTransaction();
    TimestampVersioned created =
        (TimestampVersioned)
            s.createQuery("from TimestampVersioned where id <> :initialId")
                .setLong("initialId", initialId.longValue())
                .uniqueResult();
    t.commit();
    s.close();

    assertNotNull(created.getVersion());
    // assertEquals( "version was not seeded", initialVersion, created.getVersion() );

    s = openSession();
    t = s.beginTransaction();
    s.createQuery("delete TimestampVersioned").executeUpdate();
    t.commit();
    s.close();
  }
  @SuppressWarnings({"UnnecessaryUnboxing"})
  @Test
  public void testInsertWithGeneratedVersionAndId() {
    // Make sure the env supports bulk inserts with generated ids...
    if (!supportsBulkInsertIdGeneration(IntegerVersioned.class)) {
      SkipLog.reportSkip(
          "bulk id generation not supported",
          "test bulk inserts with generated id and generated timestamp");
      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();
    s.close();

    Long initialId = entity.getId();
    int initialVersion = entity.getVersion();

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

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

    s = openSession();
    t = s.beginTransaction();
    IntegerVersioned created =
        (IntegerVersioned)
            s.createQuery("from IntegerVersioned where id <> :initialId")
                .setLong("initialId", initialId.longValue())
                .uniqueResult();
    t.commit();
    s.close();

    assertEquals("version was not seeded", initialVersion, created.getVersion());

    s = openSession();
    t = s.beginTransaction();
    s.createQuery("delete IntegerVersioned").executeUpdate();
    t.commit();
    s.close();
  }
  @Test
  public void testInsertWithGeneratedId() {
    // Make sure the env supports bulk inserts with generated ids...
    if (!supportsBulkInsertIdGeneration(PettingZoo.class)) {
      SkipLog.reportSkip(
          "bulk id generation not supported",
          "test bulk inserts with generated id and generated timestamp");
      return;
    }

    // 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();
    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);

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

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

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