org.hibernate.dialect.H2Dialect Java Examples

The following examples show how to use org.hibernate.dialect.H2Dialect. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: HibernateSessionExtension.java    From judgels with GNU General Public License v2.0 6 votes vote down vote up
@Override
public Object resolveParameter(ParameterContext parameterContext, ExtensionContext extensionContext)
        throws ParameterResolutionException {

    Configuration config = new Configuration();

    Class<?> declaringClass = parameterContext.getDeclaringExecutable().getDeclaringClass();
    WithHibernateSession annotation = getAnnotation(declaringClass);
    for (Class<?> modelClass : annotation.models()) {
        config.addAnnotatedClass(modelClass);
    }

    config.setProperty(DIALECT, H2Dialect.class.getName());
    config.setProperty(DRIVER, Driver.class.getName());
    config.setProperty(URL, "jdbc:h2:mem:./" + UUID.randomUUID().toString());
    config.setProperty(HBM2DDL_AUTO, "create");
    config.setProperty(CURRENT_SESSION_CONTEXT_CLASS, "managed");
    config.setProperty(GENERATE_STATISTICS, "false");

    SessionFactory sessionFactory = config.buildSessionFactory();
    openSession(sessionFactory, extensionContext);
    return sessionFactory;
}
 
Example #2
Source File: Hibernates.java    From dpCms with Apache License 2.0 6 votes vote down vote up
/**
 * 从DataSoure中取出connection, 根据connection的metadata中的jdbcUrl判断Dialect类型.
 * 仅支持Oracle, H2, MySql, PostgreSql, SQLServer,如需更多数据库类型,请仿照此类自行编写。
 */
public static String getDialect(DataSource dataSource) {
	String jdbcUrl = getJdbcUrlFromDataSource(dataSource);

	// 根据jdbc url判断dialect
	if (StringUtils.contains(jdbcUrl, ":h2:")) {
		return H2Dialect.class.getName();
	} else if (StringUtils.contains(jdbcUrl, ":mysql:")) {
		return MySQL5InnoDBDialect.class.getName();
	} else if (StringUtils.contains(jdbcUrl, ":oracle:")) {
		return Oracle10gDialect.class.getName();
	} else if (StringUtils.contains(jdbcUrl, ":postgresql:")) {
		return PostgreSQL82Dialect.class.getName();
	} else if (StringUtils.contains(jdbcUrl, ":sqlserver:")) {
		return SQLServer2008Dialect.class.getName();
	} else {
		throw new IllegalArgumentException("Unknown Database of " + jdbcUrl);
	}
}
 
Example #3
Source File: HibernateJpaVendorAdapter.java    From spring4-understanding with Apache License 2.0 6 votes vote down vote up
/**
 * Determine the Hibernate database dialect class for the given target database.
 * @param database the target database
 * @return the Hibernate database dialect class, or {@code null} if none found
 */
@SuppressWarnings("deprecation")
protected Class<?> determineDatabaseDialectClass(Database database) {
	switch (database) {
		case DB2: return DB2Dialect.class;
		case DERBY: return DerbyDialect.class;  // DerbyDialect deprecated in 4.x
		case H2: return H2Dialect.class;
		case HSQL: return HSQLDialect.class;
		case INFORMIX: return InformixDialect.class;
		case MYSQL: return MySQLDialect.class;
		case ORACLE: return Oracle9iDialect.class;
		case POSTGRESQL: return PostgreSQLDialect.class;  // PostgreSQLDialect deprecated in 4.x
		case SQL_SERVER: return SQLServerDialect.class;
		case SYBASE: return org.hibernate.dialect.SybaseDialect.class;  // SybaseDialect deprecated in 3.6 but not 4.x
		default: return null;
	}
}
 
Example #4
Source File: FixedH2DialectTest.java    From jhipster with Apache License 2.0 6 votes vote down vote up
@Test
public void test() {
    List<LogbackRecorder> recorders = new LinkedList<>();
    recorders.add(LogbackRecorder.forName("org.jboss.logging").reset().capture("ALL"));
    recorders.add(LogbackRecorder.forClass(Dialect.class).reset().capture("ALL"));
    recorders.add(LogbackRecorder.forClass(H2Dialect.class).reset().capture("ALL"));

    Map<Integer, String> registered = new LinkedHashMap<>();

    new FixedH2Dialect() {

        @Override
        protected void registerColumnType(int code, String name) {
            registered.put(code, name);
            super.registerColumnType(code, name);
        }

    };

    assertThat(registered.get(Types.FLOAT)).isEqualTo("real");

    recorders.forEach(LogbackRecorder::release);
}
 
Example #5
Source File: JPAUtil.java    From genericdao with Artistic License 2.0 6 votes vote down vote up
/**
 * 从DataSoure中取出connection, 根据connection的metadata中的jdbcUrl判断Dialect类型.
 * 仅支持Oracle 10, H2, MySql, PostgreSql, SQLServer,如需更多数据库类型,请仿照此类自行编写。
 */
public static String getDialect(DataSource dataSource) {
	switch (getDBType(dataSource)) {
		case H2:
			return H2Dialect.class.getName();
		case MYSQL:
			return MySQLDialectWithoutFK.class.getName();
		case ORACLE:
			return Oracle10gDialectWithoutFK.class.getName() ;
		case POSTGRESQL:
			return PostgreSQL9DialectWithoutFK.class.getName() ;
		case SQL_SERVER:
			return SQLServer2008Dialect.class.getName();
	}

	throw new IllegalArgumentException("未知的数据库类型");
}
 
Example #6
Source File: HibernateJpaVendorAdapter.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Determine the Hibernate database dialect class for the given target database.
 * @param database the target database
 * @return the Hibernate database dialect class, or {@code null} if none found
 */
@SuppressWarnings("deprecation")
protected Class<?> determineDatabaseDialectClass(Database database) {
	switch (database) {
		case DB2: return DB2Dialect.class;
		case DERBY: return DerbyDialect.class;  // DerbyDialect deprecated in 4.x
		case H2: return H2Dialect.class;
		case HSQL: return HSQLDialect.class;
		case INFORMIX: return InformixDialect.class;
		case MYSQL: return MySQL5Dialect.class;
		case ORACLE: return Oracle9iDialect.class;
		case POSTGRESQL: return PostgreSQLDialect.class;  // PostgreSQLDialect deprecated in 4.x
		case SQL_SERVER: return SQLServer2008Dialect.class;
		case SYBASE: return org.hibernate.dialect.SybaseDialect.class;  // SybaseDialect deprecated in 3.6 but not 4.x
		default: return null;
	}
}
 
Example #7
Source File: Hibernates.java    From activiti-in-action-codes with Apache License 2.0 6 votes vote down vote up
/**
 * 从DataSoure中取出connection, 根据connection的metadata中的jdbcUrl判断Dialect类型.
 * 仅支持Oracle, H2, MySql, PostgreSql, SQLServer,如需更多数据库类型,请仿照此类自行编写。
 */
public static String getDialect(DataSource dataSource) {
    String jdbcUrl = getJdbcUrlFromDataSource(dataSource);

    // 根据jdbc url判断dialect
    if (StringUtils.contains(jdbcUrl, ":h2:")) {
        return H2Dialect.class.getName();
    } else if (StringUtils.contains(jdbcUrl, ":mysql:")) {
        return MySQL5InnoDBDialect.class.getName();
    } else if (StringUtils.contains(jdbcUrl, ":oracle:")) {
        return Oracle10gDialect.class.getName();
    } else if (StringUtils.contains(jdbcUrl, ":postgresql:")) {
        return PostgreSQL82Dialect.class.getName();
    } else if (StringUtils.contains(jdbcUrl, ":sqlserver:")) {
        return SQLServer2008Dialect.class.getName();
    } else {
        throw new IllegalArgumentException("Unknown Database of " + jdbcUrl);
    }
}
 
Example #8
Source File: Hibernates.java    From activiti-in-action-codes with Apache License 2.0 6 votes vote down vote up
/**
 * 从DataSoure中取出connection, 根据connection的metadata中的jdbcUrl判断Dialect类型.
 * 仅支持Oracle, H2, MySql, PostgreSql, SQLServer,如需更多数据库类型,请仿照此类自行编写。
 */
public static String getDialect(DataSource dataSource) {
    String jdbcUrl = getJdbcUrlFromDataSource(dataSource);

    // 根据jdbc url判断dialect
    if (StringUtils.contains(jdbcUrl, ":h2:")) {
        return H2Dialect.class.getName();
    } else if (StringUtils.contains(jdbcUrl, ":mysql:")) {
        return MySQL5InnoDBDialect.class.getName();
    } else if (StringUtils.contains(jdbcUrl, ":oracle:")) {
        return Oracle10gDialect.class.getName();
    } else if (StringUtils.contains(jdbcUrl, ":postgresql:")) {
        return PostgreSQL82Dialect.class.getName();
    } else if (StringUtils.contains(jdbcUrl, ":sqlserver:")) {
        return SQLServer2008Dialect.class.getName();
    } else {
        throw new IllegalArgumentException("Unknown Database of " + jdbcUrl);
    }
}
 
Example #9
Source File: Hibernates.java    From activiti-in-action-codes with Apache License 2.0 6 votes vote down vote up
/**
 * 从DataSoure中取出connection, 根据connection的metadata中的jdbcUrl判断Dialect类型.
 * 仅支持Oracle, H2, MySql, PostgreSql, SQLServer,如需更多数据库类型,请仿照此类自行编写。
 */
public static String getDialect(DataSource dataSource) {
    String jdbcUrl = getJdbcUrlFromDataSource(dataSource);

    // 根据jdbc url判断dialect
    if (StringUtils.contains(jdbcUrl, ":h2:")) {
        return H2Dialect.class.getName();
    } else if (StringUtils.contains(jdbcUrl, ":mysql:")) {
        return MySQL5InnoDBDialect.class.getName();
    } else if (StringUtils.contains(jdbcUrl, ":oracle:")) {
        return Oracle10gDialect.class.getName();
    } else if (StringUtils.contains(jdbcUrl, ":postgresql:")) {
        return PostgreSQL82Dialect.class.getName();
    } else if (StringUtils.contains(jdbcUrl, ":sqlserver:")) {
        return SQLServer2008Dialect.class.getName();
    } else {
        throw new IllegalArgumentException("Unknown Database of " + jdbcUrl);
    }
}
 
Example #10
Source File: Hibernates.java    From dubai with MIT License 6 votes vote down vote up
/**
 * 从DataSoure中取出connection, 根据connection的metadata中的jdbcUrl判断Dialect类型.
 * 仅支持Oracle, H2, MySql, PostgreSql, SQLServer,如需更多数据库类型,请仿照此类自行编写。
 */
public static String getDialect(DataSource dataSource) {
	String jdbcUrl = getJdbcUrlFromDataSource(dataSource);

	// 根据jdbc url判断dialect
	if (StringUtils.contains(jdbcUrl, ":h2:")) {
		return H2Dialect.class.getName();
	} else if (StringUtils.contains(jdbcUrl, ":mysql:")) {
		return MySQL5InnoDBDialect.class.getName();
	} else if (StringUtils.contains(jdbcUrl, ":oracle:")) {
		return Oracle10gDialect.class.getName();
	} else if (StringUtils.contains(jdbcUrl, ":postgresql:")) {
		return PostgreSQL82Dialect.class.getName();
	} else if (StringUtils.contains(jdbcUrl, ":sqlserver:")) {
		return SQLServer2008Dialect.class.getName();
	} else {
		throw new IllegalArgumentException("Unknown Database of " + jdbcUrl);
	}
}
 
Example #11
Source File: HibernateJpaVendorAdapter.java    From java-technology-stack with MIT License 6 votes vote down vote up
/**
 * Determine the Hibernate database dialect class for the given target database.
 * @param database the target database
 * @return the Hibernate database dialect class, or {@code null} if none found
 */
@Nullable
protected Class<?> determineDatabaseDialectClass(Database database) {
	switch (database) {
		case DB2: return DB2Dialect.class;
		case DERBY: return DerbyTenSevenDialect.class;
		case H2: return H2Dialect.class;
		case HANA: return HANAColumnStoreDialect.class;
		case HSQL: return HSQLDialect.class;
		case INFORMIX: return InformixDialect.class;
		case MYSQL: return MySQL5Dialect.class;
		case ORACLE: return Oracle12cDialect.class;
		case POSTGRESQL: return PostgreSQL95Dialect.class;
		case SQL_SERVER: return SQLServer2012Dialect.class;
		case SYBASE: return SybaseDialect.class;
		default: return null;
	}
}
 
Example #12
Source File: HibernateWhereJoinTableIntegrationTest.java    From tutorials with MIT License 6 votes vote down vote up
@BeforeClass
public static void beforeTests() {
    Configuration configuration = new Configuration().addAnnotatedClass(User.class)
        .addAnnotatedClass(Group.class)
        .addAnnotatedClass(UserGroupRelation.class)
        .setProperty("hibernate.dialect", H2Dialect.class.getName())
        .setProperty("hibernate.connection.driver_class", org.h2.Driver.class.getName())
        .setProperty("hibernate.connection.url", "jdbc:h2:mem:test")
        .setProperty("hibernate.connection.username", "sa")
        .setProperty("hibernate.connection.password", "")
        .setProperty("hibernate.hbm2ddl.auto", "update");
    
    ServiceRegistry serviceRegistry = new StandardServiceRegistryBuilder()
        .applySettings(configuration.getProperties())
        .build();
    
    sessionFactory = configuration.buildSessionFactory(serviceRegistry);
}
 
Example #13
Source File: BaseCoreFunctionalTestCase.java    From google-cloud-spanner-hibernate with GNU Lesser General Public License v2.1 6 votes vote down vote up
protected Configuration constructConfiguration() {
  Configuration configuration = new Configuration();
  configuration.setProperty( AvailableSettings.CACHE_REGION_FACTORY, CachingRegionFactory.class.getName() );
  configuration.setProperty( AvailableSettings.USE_NEW_ID_GENERATOR_MAPPINGS, "true" );
  if ( createSchema() ) {
    configuration.setProperty( Environment.HBM2DDL_AUTO, "update" );
    final String secondSchemaName = createSecondSchema();
    if ( StringHelper.isNotEmpty( secondSchemaName ) ) {
      if ( !( getDialect() instanceof H2Dialect ) ) {
        throw new UnsupportedOperationException( "Only H2 dialect supports creation of second schema." );
      }
      Helper.createH2Schema( secondSchemaName, configuration );
    }
  }
  configuration.setImplicitNamingStrategy( ImplicitNamingStrategyLegacyJpaImpl.INSTANCE );
  configuration.setProperty( Environment.DIALECT, getDialect().getClass().getName() );
  return configuration;
}
 
Example #14
Source File: HibernateJpaVendorAdapter.java    From spring-analysis-note with MIT License 6 votes vote down vote up
/**
 * Determine the Hibernate database dialect class for the given target database.
 * @param database the target database
 * @return the Hibernate database dialect class, or {@code null} if none found
 */
@Nullable
protected Class<?> determineDatabaseDialectClass(Database database) {
	switch (database) {
		case DB2: return DB2Dialect.class;
		case DERBY: return DerbyTenSevenDialect.class;
		case H2: return H2Dialect.class;
		case HANA: return HANAColumnStoreDialect.class;
		case HSQL: return HSQLDialect.class;
		case INFORMIX: return InformixDialect.class;
		case MYSQL: return MySQL5Dialect.class;
		case ORACLE: return Oracle12cDialect.class;
		case POSTGRESQL: return PostgreSQL95Dialect.class;
		case SQL_SERVER: return SQLServer2012Dialect.class;
		case SYBASE: return SybaseDialect.class;
		default: return null;
	}
}
 
Example #15
Source File: RepositoryIOTest.java    From MogwaiERDesignerNG with GNU General Public License v3.0 5 votes vote down vote up
public void testLoadSaveRepository() throws
		Exception {

	Class.forName("org.h2.Driver").newInstance();
	Connection theConnection = null;
	try {
		theConnection = DriverManager.getConnection("jdbc:h2:mem:dname", "sa", "");

		Class theHibernateDialect = H2Dialect.class;

		String theModelResource = "/de/erdesignerng/test/io/repository/examplemodel.mxm";

		String theNewFile = RepositioryHelper.performRepositorySaveAndLoad(theModelResource, theHibernateDialect,
				theConnection);

		String theOriginalFile = IOUtils.toString(getClass().getResourceAsStream(theModelResource));

		assertTrue(compareStrings(theOriginalFile, theNewFile));

	} finally {
		if (theConnection != null) {

			theConnection.createStatement().execute("SHUTDOWN");
			theConnection.close();
		}
	}
}
 
Example #16
Source File: JpaConfiguration.java    From ps-guitar-db with Apache License 2.0 5 votes vote down vote up
@Bean
	public Map<String, Object> jpaProperties() {
		Map<String, Object> props = new HashMap<String, Object>();
		props.put("hibernate.dialect", H2Dialect.class.getName());
//		props.put("hibernate.cache.provider_class", HashtableCacheProvider.class.getName());
		return props;
	}
 
Example #17
Source File: ClobTest.java    From cacheonix-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
private String extractData(Clob clob) throws Throwable {
	if ( getDialect() instanceof H2Dialect ) {
		return clob.getSubString( 1, ( int ) clob.length() );
	}
	else {
		char[] data = new char[ (int) clob.length() ];
		clob.getCharacterStream().read( data );
		return new String( data );
	}
}
 
Example #18
Source File: HibernateOneToManyAnnotationMainIntegrationTest.java    From tutorials with MIT License 5 votes vote down vote up
@BeforeClass
public static void beforeTests() {
	Configuration configuration = new Configuration().addAnnotatedClass(Cart.class).addAnnotatedClass(Items.class)
			.setProperty("hibernate.dialect", H2Dialect.class.getName())
			.setProperty("hibernate.connection.driver_class", org.h2.Driver.class.getName())
			.setProperty("hibernate.connection.url", "jdbc:h2:mem:test")
			.setProperty("hibernate.connection.username", "sa").setProperty("hibernate.connection.password", "")
			.setProperty("hibernate.hbm2ddl.auto", "update");
	ServiceRegistry serviceRegistry = new StandardServiceRegistryBuilder()
			.applySettings(configuration.getProperties()).build();
	sessionFactory = configuration.buildSessionFactory(serviceRegistry);
}
 
Example #19
Source File: TestConfig.java    From katharsis-framework with Apache License 2.0 5 votes vote down vote up
private Properties hibernateProperties() {
	Properties props = new Properties();
	props.setProperty("hibernate.hbm2ddl.auto", "create");
	props.setProperty("hibernate.dialect", H2Dialect.class.getName());
	props.setProperty("hibernate.globally_quoted_identifiers", "true");
	return props;
}
 
Example #20
Source File: Database.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
private static Dialect determineDialect(MetadataBuildingOptions buildingOptions) {
	final Dialect dialect = buildingOptions.getServiceRegistry().getService( JdbcServices.class ).getDialect();
	if ( dialect != null ) {
		return dialect;
	}

	// Use H2 dialect as default
	return new H2Dialect();
}
 
Example #21
Source File: OperationsTestConfig.java    From crnk-framework with Apache License 2.0 5 votes vote down vote up
private Properties hibernateProperties() {
	Properties props = new Properties();
	props.setProperty("hibernate.dialect", H2Dialect.class.getName());
	props.setProperty("hibernate.hbm2ddl.auto", "create");
	props.setProperty("hibernate.globally_quoted_identifiers", "true");
	return props;
}
 
Example #22
Source File: JpaTestConfig.java    From crnk-framework with Apache License 2.0 5 votes vote down vote up
private Properties hibernateProperties() {
	Properties props = new Properties();
	props.setProperty("hibernate.hbm2ddl.auto", "create");
	props.setProperty("hibernate.dialect", H2Dialect.class.getName());
	props.setProperty("hibernate.globally_quoted_identifiers", "true");
	return props;
}
 
Example #23
Source File: JpaConfiguration.java    From Spring with Apache License 2.0 5 votes vote down vote up
@Bean
	public Map<String, Object> jpaProperties() {
		Map<String, Object> props = new HashMap<>();
		props.put("hibernate.dialect", H2Dialect.class.getName());
//		props.put("hibernate.cache.provider_class", HashtableCacheProvider.class.getName());
		return props;
	}
 
Example #24
Source File: AbstractServiceIntegrationTests.java    From judgels with GNU General Public License v2.0 5 votes vote down vote up
@BeforeAll
static void beforeAll() throws Exception {
    DataSourceFactory dbConfig = new DataSourceFactory();
    dbConfig.setDriverClass(Driver.class.getName());
    dbConfig.setUrl("jdbc:h2:mem:./" + URIEL_JDBC_SUFFIX);
    dbConfig.setProperties(ImmutableMap.<String, String>builder()
            .put(DIALECT, H2Dialect.class.getName())
            .put(HBM2DDL_AUTO, "create")
            .put(GENERATE_STATISTICS, "false")
            .build());

    baseDataDir = Files.createTempDirectory("uriel");

    UrielApplicationConfiguration config = new UrielApplicationConfiguration(
            dbConfig,
            WebSecurityConfiguration.DEFAULT,
            new UrielConfiguration.Builder()
                    .baseDataDir(baseDataDir.toString())
                    .jophielConfig(JophielClientConfiguration.DEFAULT)
                    .sandalphonConfig(SandalphonClientConfiguration.DEFAULT)
                    .sealtielConfig(SealtielClientConfiguration.DEFAULT)
                    .gabrielConfig(GabrielClientConfiguration.DEFAULT)
                    .submissionConfig(SubmissionConfiguration.DEFAULT)
                    .fileConfig(FileConfiguration.DEFAULT)
                    .build());

    support = new DropwizardTestSupport<>(UrielApplication.class, config);
    support.before();
}
 
Example #25
Source File: AbstractServiceIntegrationTests.java    From judgels with GNU General Public License v2.0 5 votes vote down vote up
@BeforeAll
static void beforeAll() throws Exception {
    DataSourceFactory dbConfig = new DataSourceFactory();
    dbConfig.setDriverClass(Driver.class.getName());
    dbConfig.setUrl("jdbc:h2:mem:./" + JERAHMEEL_JDBC_SUFFIX);
    dbConfig.setProperties(ImmutableMap.<String, String>builder()
            .put(DIALECT, H2Dialect.class.getName())
            .put(HBM2DDL_AUTO, "create")
            .put(GENERATE_STATISTICS, "false")
            .build());

    baseDataDir = Files.createTempDirectory("jerahmeel");

    JerahmeelApplicationConfiguration config = new JerahmeelApplicationConfiguration(
            dbConfig,
            WebSecurityConfiguration.DEFAULT,
            new JerahmeelConfiguration.Builder()
                    .baseDataDir(baseDataDir.toString())
                    .jophielConfig(JophielClientConfiguration.DEFAULT)
                    .sandalphonConfig(SandalphonClientConfiguration.DEFAULT)
                    .gabrielConfig(GabrielClientConfiguration.DEFAULT)
                    .submissionConfig(SubmissionConfiguration.DEFAULT)
                    .build());

    support = new DropwizardTestSupport<>(JerahmeelApplication.class, config);
    support.before();
}
 
Example #26
Source File: SchemaGenerationTest.java    From google-cloud-spanner-hibernate with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
protected Map buildSettings() {
	Map settings = super.buildSettings();
	if ( getDialect().getClass().equals( H2Dialect.class ) ) {
		settings.put(
				AvailableSettings.HBM2DDL_IMPORT_FILES,
				"schema-generation.sql"
		);
		settings.put( org.hibernate.cfg.AvailableSettings.HBM2DDL_AUTO, "update" );
	}
	return settings;
}
 
Example #27
Source File: StrategySelectorBuilder.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
private void addDialects(StrategySelectorImpl strategySelector) {
	addDialect( strategySelector, Cache71Dialect.class );
	addDialect( strategySelector, CUBRIDDialect.class );
	addDialect( strategySelector, DB2Dialect.class );
	addDialect( strategySelector, DB2390Dialect.class );
	addDialect( strategySelector, DB2390V8Dialect.class );
	addDialect( strategySelector, DB2400Dialect.class );
	addDialect( strategySelector, DerbyTenFiveDialect.class );
	addDialect( strategySelector, DerbyTenSixDialect.class );
	addDialect( strategySelector, DerbyTenSevenDialect.class );
	addDialect( strategySelector, FirebirdDialect.class );
	addDialect( strategySelector, FrontBaseDialect.class );
	addDialect( strategySelector, H2Dialect.class );
	addDialect( strategySelector, HANAColumnStoreDialect.class );
	addDialect( strategySelector, HANARowStoreDialect.class );
	addDialect( strategySelector, HSQLDialect.class );
	addDialect( strategySelector, InformixDialect.class );
	addDialect( strategySelector, IngresDialect.class );
	addDialect( strategySelector, Ingres9Dialect.class );
	addDialect( strategySelector, Ingres10Dialect.class );
	addDialect( strategySelector, InterbaseDialect.class );
	addDialect( strategySelector, JDataStoreDialect.class );
	addDialect( strategySelector, MckoiDialect.class );
	addDialect( strategySelector, MimerSQLDialect.class );
	addDialect( strategySelector, MySQL5Dialect.class );
	addDialect( strategySelector, MySQL5InnoDBDialect.class );
	addDialect( strategySelector, MySQL57InnoDBDialect.class );
	addDialect( strategySelector, MySQL57Dialect.class );
	addDialect( strategySelector, Oracle8iDialect.class );
	addDialect( strategySelector, Oracle9iDialect.class );
	addDialect( strategySelector, Oracle10gDialect.class );
	addDialect( strategySelector, PointbaseDialect.class );
	addDialect( strategySelector, PostgresPlusDialect.class );
	addDialect( strategySelector, PostgreSQL81Dialect.class );
	addDialect( strategySelector, PostgreSQL82Dialect.class );
	addDialect( strategySelector, PostgreSQL9Dialect.class );
	addDialect( strategySelector, ProgressDialect.class );
	addDialect( strategySelector, SAPDBDialect.class );
	addDialect( strategySelector, SQLServerDialect.class );
	addDialect( strategySelector, SQLServer2005Dialect.class );
	addDialect( strategySelector, SQLServer2008Dialect.class );
	addDialect( strategySelector, Sybase11Dialect.class );
	addDialect( strategySelector, SybaseAnywhereDialect.class );
	addDialect( strategySelector, SybaseASE15Dialect.class );
	addDialect( strategySelector, SybaseASE157Dialect.class );
	addDialect( strategySelector, TeradataDialect.class );
	addDialect( strategySelector, TimesTenDialect.class );
}
 
Example #28
Source File: EmbeddedDataSourceConfig.java    From spring-sync with Apache License 2.0 4 votes vote down vote up
@Bean
public Map<String, Object> jpaProperties() {
		Map<String, Object> props = new HashMap<String, Object>();
		props.put("hibernate.dialect", H2Dialect.class.getName());
		return props;
}
 
Example #29
Source File: AbstractServiceIntegrationTests.java    From judgels with GNU General Public License v2.0 4 votes vote down vote up
@BeforeAll
static void beforeAll() throws Exception {
    DataSourceFactory dbConfig = new DataSourceFactory();
    dbConfig.setDriverClass(Driver.class.getName());
    dbConfig.setUrl("jdbc:h2:mem:./" + UUID.randomUUID().toString());
    dbConfig.setProperties(ImmutableMap.<String, String>builder()
            .put(DIALECT, H2Dialect.class.getName())
            .put(HBM2DDL_AUTO, "create")
            .put(GENERATE_STATISTICS, "false")
            .build());

    baseDataDir = Files.createTempDirectory("jophiel");

    JophielConfiguration jophielConfig = new JophielConfiguration.Builder()
            .baseDataDir(baseDataDir.toString())
            .mailerConfig(new MailerConfiguration.Builder()
                    .host("localhost")
                    .port(2500)
                    .useSsl(false)
                    .username("wiser")
                    .password("wiser")
                    .sender("[email protected]")
                    .build())
            .userRegistrationConfig(UserRegistrationConfiguration.DEFAULT)
            .userResetPasswordConfig(UserResetPasswordConfiguration.DEFAULT)
            .userAvatarConfig(UserAvatarConfiguration.DEFAULT)
            .superadminCreatorConfig(SuperadminCreatorConfiguration.DEFAULT)
            .build();

    JophielApplicationConfiguration config = new JophielApplicationConfiguration(
            dbConfig,
            WebSecurityConfiguration.DEFAULT,
            jophielConfig);

    support = new DropwizardTestSupport<>(JophielApplication.class, config);
    support.before();

    adminHeader = AuthHeader.of(createService(SessionService.class)
            .logIn(Credentials.of("superadmin", "superadmin"))
            .getToken());
}
 
Example #30
Source File: SchemaGenerationTest.java    From google-cloud-spanner-hibernate with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Test
@RequiresDialect( H2Dialect.class )
public void testH2() {
}