Skip to content

Commit 502efa7

Browse files
committed
fix
1 parent 9e19e1f commit 502efa7

File tree

5 files changed

+14
-21
lines changed

5 files changed

+14
-21
lines changed

hibernate-reactive-core/src/test/java/org/hibernate/reactive/containers/H2Database.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ public class H2Database implements TestableDatabase {
5151
expectedDBTypeForClass.put( byte.class, "TINYINT" );
5252
expectedDBTypeForClass.put( Byte.class, "TINYINT" );
5353
expectedDBTypeForClass.put( PrimitiveByteArrayTypeDescriptor.class, "BINARY VARYING" );
54-
expectedDBTypeForClass.put( URL.class, "VARCHAR_IGNORECASE" );
55-
expectedDBTypeForClass.put( TimeZone.class, "VARCHAR_IGNORECASE" );
54+
expectedDBTypeForClass.put( URL.class, "CHARACTER VARYING" );
55+
expectedDBTypeForClass.put( TimeZone.class, "CHARACTER VARYING" );
5656
expectedDBTypeForClass.put( Date.class, "DATE" );
5757
expectedDBTypeForClass.put( Timestamp.class, "TIMESTAMP" );
5858
expectedDBTypeForClass.put( Time.class, "TIME" );
@@ -68,7 +68,7 @@ public class H2Database implements TestableDatabase {
6868
expectedDBTypeForClass.put( Character.class, "VARCHAR_IGNORECASE" );
6969
expectedDBTypeForClass.put( char.class, "VARCHAR_IGNORECASE" );
7070
expectedDBTypeForClass.put( TextType.class, "text" );
71-
expectedDBTypeForClass.put( String.class, "VARCHAR_IGNORECASE" );
71+
expectedDBTypeForClass.put( String.class, "CHARACTER VARYING" );
7272
}
7373
}
7474

hibernate-reactive-h2/build.gradle

-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ dependencies {
1212

1313
// Dependencies for using H2 with Vert.x:
1414
implementation "io.vertx:vertx-jdbc-client:${vertxVersion}"
15-
implementation 'io.agroal:agroal-api:1.12'
16-
implementation 'io.agroal:agroal-pool:1.12'
1715

1816
// Testing
1917
testImplementation 'org.assertj:assertj-core:3.20.2'

hibernate-reactive-h2/src/main/java/org/hibernate/reactive/pool/impl/H2ClientPoolConfiguration.java

+6-10
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,16 @@
77

88
import java.net.URI;
99

10-
import io.vertx.jdbcclient.JDBCConnectOptions;
10+
import io.vertx.core.json.JsonObject;
1111

1212
public class H2ClientPoolConfiguration extends DefaultSqlClientPoolConfiguration
1313
implements JdbcClientPoolConfiguration {
1414

1515
@Override
16-
public JDBCConnectOptions jdbcConnectOptions(URI uri) {
17-
18-
return new JDBCConnectOptions()
19-
// H2 connection string
20-
.setJdbcUrl( uri.toString() )
21-
// username
22-
.setUser( getUser() == null ? "SA" : getUser() )
23-
// password
24-
.setPassword( getPassword() );
16+
public JsonObject jdbcConnectOptions(URI uri) {
17+
return new JsonObject()
18+
.put( "url", H2SqlClientPool.DEFAULT_URL )
19+
.put( "user", "sa" )
20+
.put( "pass", null );
2521
}
2622
}

hibernate-reactive-h2/src/main/java/org/hibernate/reactive/pool/impl/H2SqlClientPool.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public class H2SqlClientPool extends SqlClientPool
3333

3434
private static final Log LOG = LoggerFactory.make( Log.class, MethodHandles.lookup() );
3535

36-
private static final String DEFAULT_URL = "jdbc:h2:~/hreact;DATABASE_TO_UPPER=FALSE";
36+
public static final String DEFAULT_URL = "jdbc:h2:~/hreact;DATABASE_TO_UPPER=FALSE";
3737

3838
//Asynchronous shutdown promise: we can't return it from #close as we implement a
3939
//blocking interface.
@@ -84,7 +84,7 @@ protected Pool getPool() {
8484
private Pool createPool(URI uri) {
8585
JdbcClientPoolConfiguration configuration = serviceRegistry.getService( JdbcClientPoolConfiguration.class );
8686
VertxInstance vertx = serviceRegistry.getService( VertxInstance.class );
87-
return JDBCPool.pool( vertx.getVertx(), configuration.jdbcConnectOptions( uri ), configuration.poolOptions() );
87+
return JDBCPool.pool( vertx.getVertx(), configuration.jdbcConnectOptions( uri ) );
8888
}
8989

9090
@Override

hibernate-reactive-h2/src/main/java/org/hibernate/reactive/pool/impl/JdbcClientPoolConfiguration.java

+3-4
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,8 @@
99

1010
import org.hibernate.service.Service;
1111

12-
import io.vertx.jdbcclient.JDBCConnectOptions;
12+
import io.vertx.core.json.JsonObject;
1313
import io.vertx.sqlclient.PoolOptions;
14-
import io.vertx.sqlclient.SqlConnectOptions;
1514

1615
public interface JdbcClientPoolConfiguration extends Service {
1716
/**
@@ -20,12 +19,12 @@ public interface JdbcClientPoolConfiguration extends Service {
2019
PoolOptions poolOptions();
2120

2221
/**
23-
* The {@link SqlConnectOptions} used to configure the {@code Pool}
22+
* The {@link JsonObject} used to configure the {@code Pool}
2423
*
2524
* @param uri A {@link URI} representing the JDBC URL or connection URI
2625
* specified in the configuration properties, usually via
2726
* {@link org.hibernate.cfg.Environment#JPA_JDBC_URL}, or
2827
* {@code null} if not specified.
2928
*/
30-
JDBCConnectOptions jdbcConnectOptions(URI uri);
29+
JsonObject jdbcConnectOptions(URI uri);
3130
}

0 commit comments

Comments
 (0)