java类org.hibernate.dialect.H2Dialect的实例源码

ClobTest.java 文件源码 项目:cacheonix-core 阅读 20 收藏 0 点赞 0 评论 0
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 );
    }
}
SchemaTest.java 文件源码 项目:midpoint 阅读 31 收藏 0 点赞 0 评论 0
@Test
public void generateSchemas() {
    createSQLSchema("./target/h2-schema.sql", H2Dialect.class.getName());
    createSQLSchema("./target/sqlserver-schema.sql", UnicodeSQLServer2008Dialect.class.getName());
    createSQLSchema("./target/mysql-schema.sql", MidPointMySQLDialect.class.getName());
    createSQLSchema("./target/oracle-schema.sql", MidPointOracleDialect.class.getName());
    createSQLSchema("./target/postgresql-schema.sql", MidPointPostgreSQLDialect.class.getName());
}
JpaConfiguration.java 文件源码 项目:ps-guitar-db 阅读 26 收藏 0 点赞 0 评论 0
@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;
    }
PhysicalNamingStrategyShogun2Test.java 文件源码 项目:shogun2 阅读 27 收藏 0 点赞 0 评论 0
/**
 * Tests whether physical table names are transformed to lowercase.
 *
 * @throws SQLException
 */
@Test
public void testPhysicalTableNamesAreLowercase() throws SQLException {
    String className = "SomeCamelCaseClass";
    String expectedPhysicalName = "somecamelcaseclass";
    Dialect dialect = new H2Dialect();

    assertExpectedPhysicalTableName(dialect, className, expectedPhysicalName);
}
PhysicalNamingStrategyShogun2Test.java 文件源码 项目:shogun2 阅读 25 收藏 0 点赞 0 评论 0
/**
 * Tests whether physical column are transformed to lowercase.
 *
 * @throws SQLException
 */
@Test
public void testPhysicalColumnNamesAreLowercase() throws SQLException {
    String columnName = "SomeCamelCaseColumn";
    String expectedPhysicalName = "somecamelcasecolumn";
    Dialect dialect = new H2Dialect();

    assertExpectedPhysicalColumnName(dialect, columnName, expectedPhysicalName);
}
PhysicalNamingStrategyShogun2Test.java 文件源码 项目:shogun2 阅读 23 收藏 0 点赞 0 评论 0
/**
 * Tests whether the table prefix is being respected.
 *
 * @throws SQLException
 */
@Test
public void testIfTablePrefixIsBeingUsed() throws SQLException {
    String tablePrefix = "TBL_";

    namingStrategy.setTablePrefix(tablePrefix);

    String className = "SomeCamelCaseClass";
    String expectedPhysicalName = "tbl_somecamelcaseclass";
    Dialect dialect = new H2Dialect();

    assertExpectedPhysicalTableName(dialect, className, expectedPhysicalName);
}
PhysicalNamingStrategyShogun2Test.java 文件源码 项目:shogun2 阅读 29 收藏 0 点赞 0 评论 0
/**
 * Tests whether everything is fine, if table prefix is null.
 *
 * @throws SQLException
 */
@Test
public void testIfTablePrefixIsNull() throws SQLException {
    String tablePrefix = null;

    namingStrategy.setTablePrefix(tablePrefix);

    String className = "SomeCamelCaseClass";
    String expectedPhysicalName = "somecamelcaseclass";
    Dialect dialect = new H2Dialect();

    assertExpectedPhysicalTableName(dialect, className, expectedPhysicalName);
}
PhysicalNamingStrategyShogun2Test.java 文件源码 项目:shogun2 阅读 26 收藏 0 点赞 0 评论 0
/**
 * Tests whether everything is fine, if table prefix is empty.
 *
 * @throws SQLException
 */
@Test
public void testIfTablePrefixIsEmpty() throws SQLException {
    String tablePrefix = "";

    namingStrategy.setTablePrefix(tablePrefix);

    String className = "SomeCamelCaseClass";
    String expectedPhysicalName = "somecamelcaseclass";
    Dialect dialect = new H2Dialect();

    assertExpectedPhysicalTableName(dialect, className, expectedPhysicalName);
}
Hibernates.java 文件源码 项目:netloan-project 阅读 23 收藏 0 点赞 0 评论 0
/**
 * 从DataSoure中取出connection, 根据connection的metadata中的jdbcUrl判断Dialect类型.
 * 仅支持Oracle, H2, MySql,如需更多数据库类型,请仿照此类自行编写。
 */
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 {
        throw new IllegalArgumentException("Unknown Database of " + jdbcUrl);
    }
}
HibernateConfig.java 文件源码 项目:pipes 阅读 25 收藏 0 点赞 0 评论 0
public static void configure(org.hibernate.cfg.Configuration configuration) {
    configuration.setProperty(Environment.CONNECTION_PROVIDER, AppConnectionProvider.class.getName());
    configuration.setProperty(CURRENT_SESSION_CONTEXT_CLASS, "thread");
    configuration.setProperty(DIALECT, H2Dialect.class.getName());
    configuration.setProperty(HBM2DDL_AUTO, "create-drop");
    configuration.setProperty(USE_SECOND_LEVEL_CACHE, Boolean.FALSE.toString());
    configuration.setProperty(USE_QUERY_CACHE, Boolean.FALSE.toString());
    configuration.setProperty(SHOW_SQL, Boolean.TRUE.toString());
    configuration.setProperty(FORMAT_SQL, Boolean.TRUE.toString());
    addAnnotatedClasses(configuration);
}


问题


面经


文章

微信
公众号

扫码关注公众号