Skip to content

Commit 2b41512

Browse files
committed
[hibernate#2055] Setting hibernate.query.mutation_strategy.global_temporary.create_tables to false has no effect
1 parent 42d5c04 commit 2b41512

File tree

2 files changed

+72
-68
lines changed

2 files changed

+72
-68
lines changed

hibernate-reactive-core/src/main/java/org/hibernate/reactive/query/sqm/mutation/internal/temptable/ReactiveGlobalTemporaryTableStrategy.java

+36-34
Original file line numberDiff line numberDiff line change
@@ -65,22 +65,23 @@ default void prepare(MappingModelCreationProcess mappingModelCreationProcess, Jd
6565
if ( !createIdTables ) {
6666
tableCreatedStage.complete( null );
6767
}
68-
69-
LOG.debugf( "Creating global-temp ID table : %s", getTemporaryTable().getTableExpression() );
70-
71-
connectionStage()
72-
.thenCompose( this::createTable )
73-
.whenComplete( (connection, throwable) -> releaseConnection( connection )
74-
.thenAccept( v -> {
75-
if ( throwable == null ) {
76-
setDropIdTables( configService );
77-
tableCreatedStage.complete( null );
78-
}
79-
else {
80-
tableCreatedStage.completeExceptionally( throwable );
81-
}
82-
} )
83-
);
68+
else {
69+
LOG.debugf( "Creating global-temp ID table : %s", getTemporaryTable().getTableExpression() );
70+
71+
connectionStage()
72+
.thenCompose( this::createTable )
73+
.whenComplete( (connection, throwable) -> releaseConnection( connection )
74+
.thenAccept( v -> {
75+
if ( throwable == null ) {
76+
setDropIdTables( configService );
77+
tableCreatedStage.complete( null );
78+
}
79+
else {
80+
tableCreatedStage.completeExceptionally( throwable );
81+
}
82+
} )
83+
);
84+
}
8485
}
8586

8687
private CompletionStage<Void> releaseConnection(ReactiveConnection connection) {
@@ -147,24 +148,25 @@ default void release(
147148
if ( !isDropIdTables() ) {
148149
tableDroppedStage.complete( null );
149150
}
150-
151-
setDropIdTables( false );
152-
153-
final TemporaryTable temporaryTable = getTemporaryTable();
154-
LOG.debugf( "Dropping global-tempk ID table : %s", temporaryTable.getTableExpression() );
155-
156-
connectionStage()
157-
.thenCompose( this::dropTable )
158-
.whenComplete( (connection, throwable) -> releaseConnection( connection )
159-
.thenAccept( v -> {
160-
if ( throwable == null ) {
161-
tableDroppedStage.complete( null );
162-
}
163-
else {
164-
tableDroppedStage.completeExceptionally( throwable );
165-
}
166-
} )
167-
);
151+
else {
152+
setDropIdTables( false );
153+
154+
final TemporaryTable temporaryTable = getTemporaryTable();
155+
LOG.debugf( "Dropping global-tempk ID table : %s", temporaryTable.getTableExpression() );
156+
157+
connectionStage()
158+
.thenCompose( this::dropTable )
159+
.whenComplete( (connection, throwable) -> releaseConnection( connection )
160+
.thenAccept( v -> {
161+
if ( throwable == null ) {
162+
tableDroppedStage.complete( null );
163+
}
164+
else {
165+
tableDroppedStage.completeExceptionally( throwable );
166+
}
167+
} )
168+
);
169+
}
168170
}
169171

170172
private CompletionStage<ReactiveConnection> dropTable(ReactiveConnection connection) {

hibernate-reactive-core/src/main/java/org/hibernate/reactive/query/sqm/mutation/internal/temptable/ReactivePersistentTableStrategy.java

+36-34
Original file line numberDiff line numberDiff line change
@@ -68,22 +68,23 @@ default void prepare(MappingModelCreationProcess mappingModelCreationProcess, Jd
6868
if ( !createIdTables ) {
6969
tableCreatedStage.complete( null );
7070
}
71-
72-
LOG.debugf( "Creating persistent ID table : %s", getTemporaryTable().getTableExpression() );
73-
74-
connectionStage()
75-
.thenCompose( this::createTable )
76-
.whenComplete( (connection, throwable) -> releaseConnection( connection )
77-
.thenAccept( v -> {
78-
if ( throwable == null ) {
79-
setDropIdTables( configService );
80-
tableCreatedStage.complete( null );
81-
}
82-
else {
83-
tableCreatedStage.completeExceptionally( throwable );
84-
}
85-
} )
86-
);
71+
else {
72+
LOG.debugf( "Creating persistent ID table : %s", getTemporaryTable().getTableExpression() );
73+
74+
connectionStage()
75+
.thenCompose( this::createTable )
76+
.whenComplete( (connection, throwable) -> releaseConnection( connection )
77+
.thenAccept( v -> {
78+
if ( throwable == null ) {
79+
setDropIdTables( configService );
80+
tableCreatedStage.complete( null );
81+
}
82+
else {
83+
tableCreatedStage.completeExceptionally( throwable );
84+
}
85+
} )
86+
);
87+
}
8788
}
8889

8990
private CompletionStage<Void> releaseConnection(ReactiveConnection connection) {
@@ -150,24 +151,25 @@ default void release(
150151
if ( !isDropIdTables() ) {
151152
tableDroppedStage.complete( null );
152153
}
153-
154-
setDropIdTables( false );
155-
156-
final TemporaryTable temporaryTable = getTemporaryTable();
157-
LOG.debugf( "Dropping persistent ID table : %s", temporaryTable.getTableExpression() );
158-
159-
connectionStage()
160-
.thenCompose( this::dropTable )
161-
.whenComplete( (connection, throwable) -> releaseConnection( connection )
162-
.thenAccept( v -> {
163-
if ( throwable == null ) {
164-
tableDroppedStage.complete( null );
165-
}
166-
else {
167-
tableDroppedStage.completeExceptionally( throwable );
168-
}
169-
} )
170-
);
154+
else {
155+
setDropIdTables( false );
156+
157+
final TemporaryTable temporaryTable = getTemporaryTable();
158+
LOG.debugf( "Dropping persistent ID table : %s", temporaryTable.getTableExpression() );
159+
160+
connectionStage()
161+
.thenCompose( this::dropTable )
162+
.whenComplete( (connection, throwable) -> releaseConnection( connection )
163+
.thenAccept( v -> {
164+
if ( throwable == null ) {
165+
tableDroppedStage.complete( null );
166+
}
167+
else {
168+
tableDroppedStage.completeExceptionally( throwable );
169+
}
170+
} )
171+
);
172+
}
171173
}
172174

173175
private CompletionStage<ReactiveConnection> dropTable(ReactiveConnection connection) {

0 commit comments

Comments
 (0)