org.hibernate.dialect.MySQL8Dialect Java Examples

The following examples show how to use org.hibernate.dialect.MySQL8Dialect. 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: HibernateOrmProcessor.java    From quarkus with Apache License 2.0 6 votes vote down vote up
public static Optional<String> guessDialect(Optional<String> dbKind) {
    // For now select the latest dialect from the driver
    // later, we can keep doing that but also avoid DCE
    // of all the dialects we want in so that people can override them
    String resolvedDbKind = dbKind.orElse("NO_DATABASE_KIND");
    if (DatabaseKind.isDB2(resolvedDbKind)) {
        return Optional.of(DB297Dialect.class.getName());
    }
    if (DatabaseKind.isPostgreSQL(resolvedDbKind)) {
        return Optional.of(QuarkusPostgreSQL10Dialect.class.getName());
    }
    if (DatabaseKind.isH2(resolvedDbKind)) {
        return Optional.of(QuarkusH2Dialect.class.getName());
    }
    if (DatabaseKind.isMariaDB(resolvedDbKind)) {
        return Optional.of(MariaDB103Dialect.class.getName());
    }
    if (DatabaseKind.isMySQL(resolvedDbKind)) {
        return Optional.of(MySQL8Dialect.class.getName());
    }
    if (DatabaseKind.isDerby(resolvedDbKind)) {
        return Optional.of(DerbyTenSevenDialect.class.getName());
    }
    if (DatabaseKind.isMsSQL(resolvedDbKind)) {
        return Optional.of(SQLServer2012Dialect.class.getName());
    }

    String error = dbKind.isPresent()
            ? "Hibernate extension could not guess the dialect from the database kind '" + resolvedDbKind
                    + "'. Add an explicit '" + HIBERNATE_ORM_CONFIG_PREFIX + "dialect' property."
            : "Hibernate extension cannot guess the dialect as no database kind is specified by 'quarkus.datasource.db-kind'";
    throw new ConfigurationError(error);
}
 
Example #2
Source File: TestingRegistryRule.java    From hibernate-reactive with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Override @SuppressWarnings("unchecked")
public <R extends Service> R getService(Class<R> serviceRole) {
    if ( serviceRole == VertxInstance.class ) {
        return (R) vertxService;
    }
    else if ( serviceRole == JdbcEnvironment.class ) {
        return (R) new JdbcEnvironment() {
            @Override
            public Dialect getDialect() {
                return new MySQL8Dialect();
            }

            @Override
            public ExtractedDatabaseMetaData getExtractedDatabaseMetaData() {
                return null;
            }

            @Override
            public Identifier getCurrentCatalog() {
                return null;
            }

            @Override
            public Identifier getCurrentSchema() {
                return null;
            }

            @Override
            public QualifiedObjectNameFormatter getQualifiedObjectNameFormatter() {
                return null;
            }

            @Override
            public IdentifierHelper getIdentifierHelper() {
                return null;
            }

            @Override
            public NameQualifierSupport getNameQualifierSupport() {
                return null;
            }

            @Override
            public SqlExceptionHelper getSqlExceptionHelper() {
                return null;
            }

            @Override
            public LobCreatorBuilder getLobCreatorBuilder() {
                return null;
            }

            @Override
            public TypeInfo getTypeInfoForJdbcCode(int jdbcTypeCode) {
                return null;
            }
        };
    }
    else {
        throw new IllegalArgumentException( "This is a mock service - need to explicitly handle any service we might need during testing" );
    }
}