Skip to content

Commit 23b9b8f

Browse files
committed
minor changes to BulkOperationCleanupAction
1 parent a032acb commit 23b9b8f

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

hibernate-core/src/main/java/org/hibernate/action/internal/BulkOperationCleanupAction.java

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ public BulkOperationCleanupAction(SharedSessionContractImplementor session, Set<
108108
final LinkedHashSet<String> spacesList = new LinkedHashSet<>( tableSpaces );
109109

110110
final var metamodel = session.getFactory().getMappingMetamodel();
111-
metamodel.forEachEntityDescriptor( (entityDescriptor) -> {
111+
metamodel.forEachEntityDescriptor( entityDescriptor -> {
112112
final String[] entitySpaces = (String[]) entityDescriptor.getQuerySpaces();
113113
if ( affectedEntity( tableSpaces, entitySpaces ) ) {
114114
addAll( spacesList, entitySpaces );
@@ -145,9 +145,7 @@ public static void schedule(SharedSessionContractImplementor session, SqmDmlStat
145145
}
146146
for ( var cteStatement : statement.getCteStatements() ) {
147147
if ( cteStatement.getCteDefinition() instanceof SqmDmlStatement<?> dmlStatement ) {
148-
entityPersisters.add(
149-
metamodel.getEntityDescriptor( dmlStatement.getTarget().getEntityName() )
150-
);
148+
entityPersisters.add( metamodel.getEntityDescriptor( dmlStatement.getTarget().getEntityName() ) );
151149
}
152150
}
153151

@@ -194,13 +192,14 @@ private boolean affectedEntity(Set<?> affectedTableSpaces, Serializable[] checkT
194192
if ( affectedTableSpaces == null || affectedTableSpaces.isEmpty() ) {
195193
return true;
196194
}
197-
198-
for ( Serializable checkTableSpace : checkTableSpaces ) {
199-
if ( affectedTableSpaces.contains( checkTableSpace ) ) {
200-
return true;
195+
else {
196+
for ( Serializable checkTableSpace : checkTableSpaces ) {
197+
if ( affectedTableSpaces.contains( checkTableSpace ) ) {
198+
return true;
199+
}
201200
}
201+
return false;
202202
}
203-
return false;
204203
}
205204

206205
@Override
@@ -216,17 +215,17 @@ public BeforeTransactionCompletionProcess getBeforeTransactionCompletionProcess(
216215
@Override
217216
public AfterTransactionCompletionProcess getAfterTransactionCompletionProcess() {
218217
return (success, session) -> {
219-
for ( EntityCleanup cleanup : entityCleanups ) {
218+
for ( var cleanup : entityCleanups ) {
220219
cleanup.release();
221220
}
222221
entityCleanups.clear();
223222

224-
for ( NaturalIdCleanup cleanup : naturalIdCleanups ) {
223+
for ( var cleanup : naturalIdCleanups ) {
225224
cleanup.release();
226225
}
227226
naturalIdCleanups.clear();
228227

229-
for ( CollectionCleanup cleanup : collectionCleanups ) {
228+
for ( var cleanup : collectionCleanups ) {
230229
cleanup.release();
231230
}
232231
collectionCleanups.clear();

0 commit comments

Comments
 (0)