Search in sources :

Example 1 with CompletionStages

use of org.hibernate.reactive.util.impl.CompletionStages in project hibernate-reactive by hibernate.

the class ReactiveBulkIdStrategy method release.

@Override
public void release(JdbcServices jdbcServices, JdbcConnectionAccess connectionAccess) {
    if (serviceRegistry != null && !dropGlobalTemporaryTables.isEmpty()) {
        boolean dropIdTables = serviceRegistry.getService(ConfigurationService.class).getSetting(GlobalTemporaryTableBulkIdStrategy.DROP_ID_TABLES, StandardConverters.BOOLEAN, false);
        if (dropIdTables) {
            ReactiveConnection connection = serviceRegistry.getService(ReactiveConnectionPool.class).getProxyConnection();
            loop(dropGlobalTemporaryTables, connection::execute).whenComplete((v, e) -> connection.close()).handle(CompletionStages::ignoreErrors).toCompletableFuture().join();
        }
    }
}
Also used : ReactiveConnectionPool(org.hibernate.reactive.pool.ReactiveConnectionPool) MetadataBuildingOptions(org.hibernate.boot.spi.MetadataBuildingOptions) StandardConverters(org.hibernate.engine.config.spi.StandardConverters) ParameterSpecification(org.hibernate.param.ParameterSpecification) MultiTableBulkIdStrategy(org.hibernate.hql.spi.id.MultiTableBulkIdStrategy) IdTableInfo(org.hibernate.hql.spi.id.IdTableInfo) GlobalTemporaryTableBulkIdStrategy(org.hibernate.hql.spi.id.global.GlobalTemporaryTableBulkIdStrategy) PersistentClass(org.hibernate.mapping.PersistentClass) AbstractTableBasedBulkIdHandler(org.hibernate.hql.spi.id.AbstractTableBasedBulkIdHandler) StatementsWithParameters(org.hibernate.reactive.bulk.StatementsWithParameters) SessionFactoryImplementor(org.hibernate.engine.spi.SessionFactoryImplementor) StandardServiceRegistry(org.hibernate.boot.registry.StandardServiceRegistry) AssignmentSpecification(org.hibernate.hql.internal.ast.tree.AssignmentSpecification) Set(java.util.Set) Collectors(java.util.stream.Collectors) DB297Dialect(org.hibernate.dialect.DB297Dialect) ArrayHelper(org.hibernate.internal.util.collections.ArrayHelper) List(java.util.List) CompletionStage(java.util.concurrent.CompletionStage) Dialect(org.hibernate.dialect.Dialect) UpdateStatement(org.hibernate.hql.internal.ast.tree.UpdateStatement) CompletionStages.loop(org.hibernate.reactive.util.impl.CompletionStages.loop) Update(org.hibernate.sql.Update) SharedSessionContractImplementor(org.hibernate.engine.spi.SharedSessionContractImplementor) CompletionStages(org.hibernate.reactive.util.impl.CompletionStages) JdbcConnectionAccess(org.hibernate.engine.jdbc.connections.spi.JdbcConnectionAccess) CoreMessageLogger(org.hibernate.internal.CoreMessageLogger) SqlStringGenerationContext(org.hibernate.boot.model.relational.SqlStringGenerationContext) Queryable(org.hibernate.persister.entity.Queryable) CollectionType(org.hibernate.type.CollectionType) SessionFactoryOptions(org.hibernate.boot.spi.SessionFactoryOptions) ReactiveConnectionPool(org.hibernate.reactive.pool.ReactiveConnectionPool) FromElement(org.hibernate.hql.internal.ast.tree.FromElement) ArrayList(java.util.ArrayList) HashSet(java.util.HashSet) AbstractCollectionPersister(org.hibernate.persister.collection.AbstractCollectionPersister) MetadataImplementor(org.hibernate.boot.spi.MetadataImplementor) DeleteStatement(org.hibernate.hql.internal.ast.tree.DeleteStatement) ConfigurationService(org.hibernate.engine.config.spi.ConfigurationService) AbstractMultiTableBulkIdStrategyImpl(org.hibernate.hql.spi.id.AbstractMultiTableBulkIdStrategyImpl) QueryParameters(org.hibernate.engine.spi.QueryParameters) Parameters(org.hibernate.reactive.pool.impl.Parameters) JdbcServices(org.hibernate.engine.jdbc.spi.JdbcServices) ReactiveQueryExecutor(org.hibernate.reactive.session.ReactiveQueryExecutor) Delete(org.hibernate.sql.Delete) Table(org.hibernate.mapping.Table) IdTableInfoImpl(org.hibernate.hql.spi.id.local.IdTableInfoImpl) AbstractRestrictableStatement(org.hibernate.hql.internal.ast.tree.AbstractRestrictableStatement) HqlSqlWalker(org.hibernate.hql.internal.ast.HqlSqlWalker) Collections(java.util.Collections) CoreLogging(org.hibernate.internal.CoreLogging) Type(org.hibernate.type.Type) ReactiveConnection(org.hibernate.reactive.pool.ReactiveConnection) CompletionStages.zeroFuture(org.hibernate.reactive.util.impl.CompletionStages.zeroFuture) CompletionStages(org.hibernate.reactive.util.impl.CompletionStages) ReactiveConnection(org.hibernate.reactive.pool.ReactiveConnection) ConfigurationService(org.hibernate.engine.config.spi.ConfigurationService)

Aggregations

ArrayList (java.util.ArrayList)1 Collections (java.util.Collections)1 HashSet (java.util.HashSet)1 List (java.util.List)1 Set (java.util.Set)1 CompletionStage (java.util.concurrent.CompletionStage)1 Collectors (java.util.stream.Collectors)1 SqlStringGenerationContext (org.hibernate.boot.model.relational.SqlStringGenerationContext)1 StandardServiceRegistry (org.hibernate.boot.registry.StandardServiceRegistry)1 MetadataBuildingOptions (org.hibernate.boot.spi.MetadataBuildingOptions)1 MetadataImplementor (org.hibernate.boot.spi.MetadataImplementor)1 SessionFactoryOptions (org.hibernate.boot.spi.SessionFactoryOptions)1 DB297Dialect (org.hibernate.dialect.DB297Dialect)1 Dialect (org.hibernate.dialect.Dialect)1 ConfigurationService (org.hibernate.engine.config.spi.ConfigurationService)1 StandardConverters (org.hibernate.engine.config.spi.StandardConverters)1 JdbcConnectionAccess (org.hibernate.engine.jdbc.connections.spi.JdbcConnectionAccess)1 JdbcServices (org.hibernate.engine.jdbc.spi.JdbcServices)1 QueryParameters (org.hibernate.engine.spi.QueryParameters)1 SessionFactoryImplementor (org.hibernate.engine.spi.SessionFactoryImplementor)1