@Override
  protected void setUp() throws Exception {
    super.setUp();

    Properties properties = new Properties();
    properties.setProperty(SequenceGenerator.SEQUENCE, TEST_SEQUENCE);
    properties.setProperty(SequenceHiLoGenerator.MAX_LO, "0"); // JPA allocationSize of 1
    properties.put(
        PersistentIdentifierGenerator.IDENTIFIER_NORMALIZER,
        new ObjectNameNormalizer() {
          @Override
          protected boolean isUseQuotedIdentifiersGlobally() {
            return false;
          }

          @Override
          protected NamingStrategy getNamingStrategy() {
            return cfg.getNamingStrategy();
          }
        });

    Dialect dialect = new H2Dialect();

    generator = new SequenceHiLoGenerator();
    generator.configure(Hibernate.LONG, properties, dialect);

    cfg =
        TestingDatabaseInfo.buildBaseConfiguration()
            .setProperty(Environment.HBM2DDL_AUTO, "create-drop");
    cfg.addAuxiliaryDatabaseObject(
        new SimpleAuxiliaryDatabaseObject(
            generator.sqlCreateStrings(dialect)[0], generator.sqlDropStrings(dialect)[0]));

    sessionFactory = (SessionFactoryImplementor) cfg.buildSessionFactory();
  }
  @Before
  public void setUp() throws Exception {
    Properties properties = new Properties();
    properties.setProperty(TableGenerator.TABLE, GEN_TABLE);
    properties.setProperty(TableGenerator.COLUMN, GEN_COLUMN);
    properties.setProperty(TableHiLoGenerator.MAX_LO, "3");
    properties.put(
        PersistentIdentifierGenerator.IDENTIFIER_NORMALIZER,
        new ObjectNameNormalizer() {
          @Override
          protected boolean isUseQuotedIdentifiersGlobally() {
            return false;
          }

          @Override
          protected NamingStrategy getNamingStrategy() {
            return cfg.getNamingStrategy();
          }
        });

    Dialect dialect = new H2Dialect();

    generator = new TableHiLoGenerator();
    generator.configure(StandardBasicTypes.LONG, properties, dialect);

    cfg =
        TestingDatabaseInfo.buildBaseConfiguration()
            .setProperty(Environment.HBM2DDL_AUTO, "create-drop");
    cfg.addAuxiliaryDatabaseObject(
        new SimpleAuxiliaryDatabaseObject(
            generator.sqlCreateStrings(dialect)[0], generator.sqlDropStrings(dialect)[0]));

    cfg.addAuxiliaryDatabaseObject(
        new SimpleAuxiliaryDatabaseObject(generator.sqlCreateStrings(dialect)[1], null));

    serviceRegistry = ServiceRegistryBuilder.buildServiceRegistry(cfg.getProperties());
    sessionFactory = (SessionFactoryImplementor) cfg.buildSessionFactory(serviceRegistry);
  }