Java 类org.hibernate.dialect.MySQL5InnoDBDialect 实例源码

项目:alfresco-repository    文件:ValidatingVisitorTest.java   
@Before
public void setUp() throws Exception
{
    refTable = new Table("reference_table");
    refIndex = new Index(refTable, "index_name", Arrays.asList("a", "b", "c"));
    ctx = new DiffContext(new MySQL5InnoDBDialect(), refSchema, targetSchema);
    visitor = new ValidatingVisitor(ctx);

    validators = new ArrayList<DbValidator>();
    validators.add(Mockito.mock(DbValidator.class));
    validators.add(Mockito.mock(DbValidator.class));
    refIndex.setValidators(validators);

    targetTable = new Table("target_table");
    targetIndex1 = new Index(targetTable, "index_name", Arrays.asList("a", "b", "c"));
    targetIndex2 = new Index(targetTable, "another_index", Arrays.asList("a", "b", "c"));
    targetIndex3 = new Index(targetTable, "index_name", Arrays.asList("e", "f"));

    comparisonUtils = Mockito.mock(ComparisonUtils.class);
    visitor.setComparisonUtils(comparisonUtils);
}
项目:dpCms    文件:Hibernates.java   
/**
 * 从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);
    }
}
项目:invesdwin-context-persistence    文件:HibernateDialectSpecificDelegate.java   
private Class<? extends Dialect> getHibernateDialect(final PersistenceUnitContext context) {
    final ConnectionDialect dialect = context.getConnectionDialect();
    switch (dialect) {
    case MSSQLSERVER:
        return SQLServerDialect.class;
    case MYSQL:
        return MySQL5InnoDBDialect.class;
    case POSTGRESQL:
        return PostgreSQL9Dialect.class;
    case ORACLE:
        return Oracle10gDialect.class;
    case H2:
        return H2Dialect.class;
    default:
        throw UnknownArgumentException.newInstance(ConnectionDialect.class, dialect);
    }
}
项目:g2    文件:Hibernates.java   
/**
 * 从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);
    }
}
项目:g2    文件:HibernatesTest.java   
@Test
public void testGetDialect() throws SQLException {
    DataSource mockDataSource = mock(DataSource.class);
    Connection mockConnection = mock(Connection.class);
    DatabaseMetaData mockMetaData = mock(DatabaseMetaData.class);

    when(mockDataSource.getConnection()).thenReturn(mockConnection);
    when(mockConnection.getMetaData()).thenReturn(mockMetaData);

    when(mockMetaData.getURL()).thenReturn("jdbc:h2:file:~/test;AUTO_SERVER=TRUE");
    String dialect = Hibernates.getDialect(mockDataSource);
    assertThat(dialect).isEqualTo(H2Dialect.class.getName());

    when(mockMetaData.getURL()).thenReturn("jdbc:mysql://localhost:3306/test");
    dialect = Hibernates.getDialect(mockDataSource);
    assertThat(dialect).isEqualTo(MySQL5InnoDBDialect.class.getName());

    when(mockMetaData.getURL()).thenReturn("jdbc:oracle:thin:@127.0.0.1:1521:XE");
    dialect = Hibernates.getDialect(mockDataSource);
    assertThat(dialect).isEqualTo(Oracle10gDialect.class.getName());
}
项目:myjavacode    文件:Hibernates.java   
/**
 * 从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);
    }
}
项目:myjavacode    文件:Hibernates.java   
/**
 * 从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);
    }
}
项目:myjavacode    文件:Hibernates.java   
/**
 * 从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);
    }
}
项目:activiti-in-action-codes    文件:Hibernates.java   
/**
 * 从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);
    }
}
项目:activiti-in-action-codes    文件:Hibernates.java   
/**
 * 从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);
    }
}
项目:activiti-in-action-codes    文件:Hibernates.java   
/**
 * 从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);
    }
}
项目:community-edition-old    文件:ValidatingVisitorTest.java   
@Before
public void setUp() throws Exception
{
    refTable = new Table("reference_table");
    refIndex = new Index(refTable, "index_name", Arrays.asList("a", "b", "c"));
    ctx = new DiffContext(new MySQL5InnoDBDialect(), refSchema, targetSchema);
    visitor = new ValidatingVisitor(ctx);

    validators = new ArrayList<DbValidator>();
    validators.add(Mockito.mock(DbValidator.class));
    validators.add(Mockito.mock(DbValidator.class));
    refIndex.setValidators(validators);

    targetTable = new Table("target_table");
    targetIndex1 = new Index(targetTable, "index_name", Arrays.asList("a", "b", "c"));
    targetIndex2 = new Index(targetTable, "another_index", Arrays.asList("a", "b", "c"));
    targetIndex3 = new Index(targetTable, "index_name", Arrays.asList("e", "f"));

    comparisonUtils = Mockito.mock(ComparisonUtils.class);
    visitor.setComparisonUtils(comparisonUtils);
}
项目:2fa-demo    文件:PersistenceJpaConfig.java   
private Properties additionalProperties() {
    String dialect;

    switch (dbType) {
    case "postgres":
        dialect = PostgreSQL9Dialect.class.getName();
        break;
    case "mysql":
        dialect = MySQL5InnoDBDialect.class.getName();
        break;
    default:
        throw new IllegalArgumentException(dbType + " not recognized");
    }

    log.debug("Setting hibernate dialect {}", dialect);

    Properties properties = new Properties();
    properties.setProperty("hibernate.hbm2ddl.auto", "create-drop");
    properties.setProperty("hibernate.dialect", dialect);
    properties.setProperty("hibernate.show_sql", "false");
    return properties;
}
项目:appengine    文件:HibernatesTest.java   
@Test
public void testGetDialect() throws SQLException {
    DataSource mockDataSource = Mockito.mock(DataSource.class);
    Connection mockConnection = Mockito.mock(Connection.class);
    DatabaseMetaData mockMetaData = Mockito.mock(DatabaseMetaData.class);

    Mockito.when(mockDataSource.getConnection()).thenReturn(mockConnection);
    Mockito.when(mockConnection.getMetaData()).thenReturn(mockMetaData);

    Mockito.when(mockMetaData.getURL()).thenReturn("jdbc:h2:file:~/test;AUTO_SERVER=TRUE");
    String dialect = Hibernates.getDialect(mockDataSource);
    assertEquals(H2Dialect.class.getName(), dialect);

    Mockito.when(mockMetaData.getURL()).thenReturn("jdbc:mysql://localhost:3306/test");
    dialect = Hibernates.getDialect(mockDataSource);
    assertEquals(MySQL5InnoDBDialect.class.getName(), dialect);

    Mockito.when(mockMetaData.getURL()).thenReturn("jdbc:oracle:thin:@127.0.0.1:1521:XE");
    dialect = Hibernates.getDialect(mockDataSource);
    assertEquals(Oracle10gDialect.class.getName(), dialect);
}
项目:alfresco-repository    文件:SchemaComparatorTest.java   
@Before
public void setup()
{
    reference = new Schema("schema", "alf_", 590, true);
    target = new Schema("schema", "alf_", 590, true);
    dialect = new MySQL5InnoDBDialect();
}
项目:community-edition-old    文件:SchemaComparatorTest.java   
@Before
public void setup()
{
    reference = new Schema("schema", "alf_", 590, true);
    target = new Schema("schema", "alf_", 590, true);
    dialect = new MySQL5InnoDBDialect();
}
项目:netloan-project    文件:Hibernates.java   
/**
 * 从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);
    }
}
项目:appengine    文件:Hibernates.java   
/**
 * 从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);
    }
}
项目:lams    文件:StrategySelectorBuilder.java   
private void addDialects(StrategySelectorImpl strategySelector) {
    addDialect( strategySelector, Cache71Dialect.class );
    addDialect( strategySelector, CUBRIDDialect.class );
    addDialect( strategySelector, DB2Dialect.class );
    addDialect( strategySelector, DB2390Dialect.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, 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, MySQL5Dialect.class );
    addDialect( strategySelector, MySQL5InnoDBDialect.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 );
}