Skip to content

Commit 0702ecd

Browse files
committed
[hibernate#929] Adapting H2SqlClientPool
1 parent c2eb3f7 commit 0702ecd

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

hibernate-reactive-core/src/main/java/org/hibernate/reactive/pool/impl/ReactiveConnectionPoolInitiator.java

+7-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,13 @@ public ReactiveConnectionPoolInitiator() {}
3838
@Override
3939
public ReactiveConnectionPool initiateService(Map configurationValues, ServiceRegistryImplementor registry) {
4040
Object configValue = configurationValues.get( Settings.SQL_CLIENT_POOL );
41-
if (configValue==null) {
41+
42+
String dbType = (String) configurationValues.get( "db" );
43+
if ( dbType.equalsIgnoreCase( "h2" ) ) {
44+
configValue = "org.hibernate.reactive.pool.impl.H2SqlClientPool";
45+
}
46+
47+
if ( configValue == null ) {
4248
return new DefaultSqlClientPool();
4349
}
4450

hibernate-reactive-core/src/main/java/org/hibernate/reactive/provider/service/NoJdbcEnvironmentInitiator.java

+5-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import org.hibernate.dialect.CockroachDB201Dialect;
1010
import org.hibernate.dialect.DB297Dialect;
1111
import org.hibernate.dialect.Dialect;
12+
import org.hibernate.dialect.H2Dialect;
1213
import org.hibernate.dialect.MariaDB103Dialect;
1314
import org.hibernate.dialect.MySQL8Dialect;
1415
import org.hibernate.dialect.Oracle12cDialect;
@@ -35,7 +36,7 @@
3536
/**
3637
* A Hibernate {@link StandardServiceInitiator service initiator} that
3738
* provides an implementation of {@link JdbcEnvironment} that infers
38-
* the Hibernate {@link org.hibernate.dialect.Dialect} from the JDBC URL.
39+
* the Hibernate {@link Dialect} from the JDBC URL.
3940
*/
4041
public class NoJdbcEnvironmentInitiator extends JdbcEnvironmentInitiator {
4142
private static final Log LOG = LoggerFactory.make( Log.class, MethodHandles.lookup() );
@@ -147,6 +148,9 @@ else if ( url.startsWith( "sqlserver:" ) ) {
147148
else if ( url.startsWith( "oracle:" ) ) {
148149
return Oracle12cDialect.class;
149150
}
151+
else if ( url.startsWith( "h2:" ) ) {
152+
return H2Dialect.class;
153+
}
150154
else {
151155
return null;
152156
}

0 commit comments

Comments
 (0)