Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
blafond committed Apr 1, 2022
1 parent 9e19e1f commit 502efa7
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ public class H2Database implements TestableDatabase {
expectedDBTypeForClass.put( byte.class, "TINYINT" );
expectedDBTypeForClass.put( Byte.class, "TINYINT" );
expectedDBTypeForClass.put( PrimitiveByteArrayTypeDescriptor.class, "BINARY VARYING" );
expectedDBTypeForClass.put( URL.class, "VARCHAR_IGNORECASE" );
expectedDBTypeForClass.put( TimeZone.class, "VARCHAR_IGNORECASE" );
expectedDBTypeForClass.put( URL.class, "CHARACTER VARYING" );
expectedDBTypeForClass.put( TimeZone.class, "CHARACTER VARYING" );
expectedDBTypeForClass.put( Date.class, "DATE" );
expectedDBTypeForClass.put( Timestamp.class, "TIMESTAMP" );
expectedDBTypeForClass.put( Time.class, "TIME" );
Expand All @@ -68,7 +68,7 @@ public class H2Database implements TestableDatabase {
expectedDBTypeForClass.put( Character.class, "VARCHAR_IGNORECASE" );
expectedDBTypeForClass.put( char.class, "VARCHAR_IGNORECASE" );
expectedDBTypeForClass.put( TextType.class, "text" );
expectedDBTypeForClass.put( String.class, "VARCHAR_IGNORECASE" );
expectedDBTypeForClass.put( String.class, "CHARACTER VARYING" );
}
}

Expand Down
2 changes: 0 additions & 2 deletions hibernate-reactive-h2/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ dependencies {

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

// Testing
testImplementation 'org.assertj:assertj-core:3.20.2'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,16 @@

import java.net.URI;

import io.vertx.jdbcclient.JDBCConnectOptions;
import io.vertx.core.json.JsonObject;

public class H2ClientPoolConfiguration extends DefaultSqlClientPoolConfiguration
implements JdbcClientPoolConfiguration {

@Override
public JDBCConnectOptions jdbcConnectOptions(URI uri) {

return new JDBCConnectOptions()
// H2 connection string
.setJdbcUrl( uri.toString() )
// username
.setUser( getUser() == null ? "SA" : getUser() )
// password
.setPassword( getPassword() );
public JsonObject jdbcConnectOptions(URI uri) {
return new JsonObject()
.put( "url", H2SqlClientPool.DEFAULT_URL )
.put( "user", "sa" )
.put( "pass", null );
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public class H2SqlClientPool extends SqlClientPool

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

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

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

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@

import org.hibernate.service.Service;

import io.vertx.jdbcclient.JDBCConnectOptions;
import io.vertx.core.json.JsonObject;
import io.vertx.sqlclient.PoolOptions;
import io.vertx.sqlclient.SqlConnectOptions;

public interface JdbcClientPoolConfiguration extends Service {
/**
Expand All @@ -20,12 +19,12 @@ public interface JdbcClientPoolConfiguration extends Service {
PoolOptions poolOptions();

/**
* The {@link SqlConnectOptions} used to configure the {@code Pool}
* The {@link JsonObject} used to configure the {@code Pool}
*
* @param uri A {@link URI} representing the JDBC URL or connection URI
* specified in the configuration properties, usually via
* {@link org.hibernate.cfg.Environment#JPA_JDBC_URL}, or
* {@code null} if not specified.
*/
JDBCConnectOptions jdbcConnectOptions(URI uri);
JsonObject jdbcConnectOptions(URI uri);
}

0 comments on commit 502efa7

Please sign in to comment.