Skip to content

Commit

Permalink
[hibernate#929] Adapting H2SqlClientPool
Browse files Browse the repository at this point in the history
  • Loading branch information
blafond committed Mar 29, 2022
1 parent c2eb3f7 commit 0702ecd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,13 @@ public ReactiveConnectionPoolInitiator() {}
@Override
public ReactiveConnectionPool initiateService(Map configurationValues, ServiceRegistryImplementor registry) {
Object configValue = configurationValues.get( Settings.SQL_CLIENT_POOL );
if (configValue==null) {

String dbType = (String) configurationValues.get( "db" );
if ( dbType.equalsIgnoreCase( "h2" ) ) {
configValue = "org.hibernate.reactive.pool.impl.H2SqlClientPool";
}

if ( configValue == null ) {
return new DefaultSqlClientPool();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import org.hibernate.dialect.CockroachDB201Dialect;
import org.hibernate.dialect.DB297Dialect;
import org.hibernate.dialect.Dialect;
import org.hibernate.dialect.H2Dialect;
import org.hibernate.dialect.MariaDB103Dialect;
import org.hibernate.dialect.MySQL8Dialect;
import org.hibernate.dialect.Oracle12cDialect;
Expand All @@ -35,7 +36,7 @@
/**
* A Hibernate {@link StandardServiceInitiator service initiator} that
* provides an implementation of {@link JdbcEnvironment} that infers
* the Hibernate {@link org.hibernate.dialect.Dialect} from the JDBC URL.
* the Hibernate {@link Dialect} from the JDBC URL.
*/
public class NoJdbcEnvironmentInitiator extends JdbcEnvironmentInitiator {
private static final Log LOG = LoggerFactory.make( Log.class, MethodHandles.lookup() );
Expand Down Expand Up @@ -147,6 +148,9 @@ else if ( url.startsWith( "sqlserver:" ) ) {
else if ( url.startsWith( "oracle:" ) ) {
return Oracle12cDialect.class;
}
else if ( url.startsWith( "h2:" ) ) {
return H2Dialect.class;
}
else {
return null;
}
Expand Down

0 comments on commit 0702ecd

Please sign in to comment.