Skip to content

Commit 294120c

Browse files
dreab8DavideD
authored andcommitted
[#2055] Setting hibernate.query.mutation_strategy.global_temporary.create_tables to false has no effect
1 parent 85fdfa3 commit 294120c

File tree

2 files changed

+73
-71
lines changed

2 files changed

+73
-71
lines changed

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

+37-37
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@
2727

2828
public interface ReactiveGlobalTemporaryTableStrategy {
2929

30-
Log LOG = make( Log.class, lookup() );
31-
3230
static String sessionIdentifier(SharedSessionContractImplementor session) {
3331
return session.getSessionIdentifier().toString();
3432
}
@@ -65,22 +63,23 @@ default void prepare(MappingModelCreationProcess mappingModelCreationProcess, Jd
6563
if ( !createIdTables ) {
6664
tableCreatedStage.complete( null );
6765
}
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-
);
66+
else {
67+
make( Log.class, lookup() ).debugf( "Creating global-temp ID table : %s", getTemporaryTable().getTableExpression() );
68+
69+
connectionStage()
70+
.thenCompose( this::createTable )
71+
.whenComplete( (connection, throwable) -> releaseConnection( connection )
72+
.thenAccept( v -> {
73+
if ( throwable == null ) {
74+
setDropIdTables( configService );
75+
tableCreatedStage.complete( null );
76+
}
77+
else {
78+
tableCreatedStage.completeExceptionally( throwable );
79+
}
80+
} )
81+
);
82+
}
8483
}
8584

8685
private CompletionStage<Void> releaseConnection(ReactiveConnection connection) {
@@ -103,7 +102,7 @@ private CompletionStage<Void> releaseConnection(ReactiveConnection connection) {
103102

104103
private static void logConnectionClosedError(Throwable t) {
105104
if ( t != null ) {
106-
LOG.debugf( "Ignoring error closing the connection: %s", t.getMessage() );
105+
make( Log.class, lookup() ).debugf( "Ignoring error closing the connection: %s", t.getMessage() );
107106
}
108107
}
109108

@@ -147,24 +146,25 @@ default void release(
147146
if ( !isDropIdTables() ) {
148147
tableDroppedStage.complete( null );
149148
}
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-
);
149+
else {
150+
setDropIdTables( false );
151+
152+
final TemporaryTable temporaryTable = getTemporaryTable();
153+
make( Log.class, lookup() ).debugf( "Dropping global-tempk ID table : %s", temporaryTable.getTableExpression() );
154+
155+
connectionStage()
156+
.thenCompose( this::dropTable )
157+
.whenComplete( (connection, throwable) -> releaseConnection( connection )
158+
.thenAccept( v -> {
159+
if ( throwable == null ) {
160+
tableDroppedStage.complete( null );
161+
}
162+
else {
163+
tableDroppedStage.completeExceptionally( throwable );
164+
}
165+
} )
166+
);
167+
}
168168
}
169169

170170
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)