Skip to content

Commit

Permalink
Upgrade to Hibernate Reactive 2.0.0.CR1
Browse files Browse the repository at this point in the history
  • Loading branch information
Sanne committed Apr 23, 2023
1 parent 7cd9c4e commit 9e464cc
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 10 deletions.
2 changes: 1 addition & 1 deletion bom/application/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
<hibernate-orm.version>6.2.1.Final</hibernate-orm.version> <!-- When updating, align bytebuddy.version to Hibernate needs as well (just below): -->
<bytebuddy.version>1.12.18</bytebuddy.version> <!-- Version controlled by Hibernate ORM's needs -->
<hibernate-commons-annotations.version>6.0.6.Final</hibernate-commons-annotations.version> <!-- version controlled by Hibernate ORM -->
<hibernate-reactive.version>2.0.0.Beta2</hibernate-reactive.version>
<hibernate-reactive.version>2.0.0.CR1</hibernate-reactive.version>
<hibernate-validator.version>8.0.0.Final</hibernate-validator.version>
<hibernate-search.version>6.1.7.Final</hibernate-search.version>
<narayana.version>6.0.0.Final</narayana.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ public class SettingsSpyingIdentifierGenerator implements IdentifierGenerator {
public static final List<Map<String, Object>> collectedSettings = new ArrayList<>();

@Override
@SuppressWarnings({ "unchecked", "rawtypes" })
public void configure(Type type, Properties params, ServiceRegistry serviceRegistry) throws MappingException {
collectedSettings.add(new HashMap<>(serviceRegistry.getService(ConfigurationService.class).getSettings()));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,9 @@
import java.util.Map;

import org.hibernate.boot.registry.StandardServiceInitiator;
import org.hibernate.dialect.Dialect;
import org.hibernate.engine.jdbc.env.spi.JdbcEnvironment;
import org.hibernate.engine.jdbc.spi.JdbcServices;
import org.hibernate.engine.jdbc.spi.SqlStatementLogger;
import org.hibernate.reactive.pool.ReactiveConnectionPool;
import org.hibernate.reactive.pool.impl.ExternalSqlClientPool;
import org.hibernate.reactive.pool.impl.Parameters;
import org.hibernate.service.spi.ServiceRegistryImplementor;

import io.quarkus.hibernate.orm.runtime.migration.MultiTenancyStrategy;
Expand Down Expand Up @@ -37,10 +33,8 @@ public ReactiveConnectionPool initiateService(Map configurationValues, ServiceRe
// nothing to do, but given the separate hierarchies have to handle this here.
return null;
}
SqlStatementLogger sqlStatementLogger = registry.getService(JdbcServices.class).getSqlStatementLogger();
final Dialect dialect = registry.getService(JdbcEnvironment.class).getDialect();
Parameters parameters = Parameters.instance(dialect);
return new ExternalSqlClientPool(pool, sqlStatementLogger, parameters);
final JdbcServices jdbcService = registry.getService(JdbcServices.class);
return new ExternalSqlClientPool(pool, jdbcService.getSqlStatementLogger(), jdbcService.getSqlExceptionHelper());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,15 @@ public static Mutiny.Query<?> bindParameters(Mutiny.Query<?> query, Object[] par
return query;
}

public static Mutiny.SelectionQuery<?> bindParameters(Mutiny.SelectionQuery<?> query, Object[] params) {
if (params == null || params.length == 0)
return query;
for (int i = 0; i < params.length; i++) {
query.setParameter(i + 1, params[i]);
}
return query;
}

public static Mutiny.Query<?> bindParameters(Mutiny.Query<?> query, Map<String, Object> params) {
if (params == null || params.size() == 0)
return query;
Expand All @@ -369,6 +378,15 @@ public static Mutiny.Query<?> bindParameters(Mutiny.Query<?> query, Map<String,
return query;
}

public static Mutiny.SelectionQuery<?> bindParameters(Mutiny.SelectionQuery<?> query, Map<String, Object> params) {
if (params == null || params.size() == 0)
return query;
for (Entry<String, Object> entry : params.entrySet()) {
query.setParameter(entry.getKey(), entry.getValue());
}
return query;
}

public static Uni<Integer> executeUpdate(String query, Object... params) {
return getSession().chain(session -> {
Mutiny.Query<?> jpaQuery = session.createQuery(query);
Expand Down

0 comments on commit 9e464cc

Please sign in to comment.