Skip to content

Commit 7bf0834

Browse files
committed
minor changes
1 parent 182c025 commit 7bf0834

File tree

2 files changed

+17
-24
lines changed

2 files changed

+17
-24
lines changed

hibernate-reactive-core/src/main/java/org/hibernate/reactive/session/impl/ReactiveSessionImpl.java

+8-16
Original file line numberDiff line numberDiff line change
@@ -1435,7 +1435,7 @@ protected final CompletionStage<T> doLoad(Object id, LoadEventListener.LoadType
14351435
}
14361436

14371437
private class ReactiveMultiIdentifierLoadAccessImpl<T> implements MultiIdLoadOptions {
1438-
private final EntityPersister entityPersister;
1438+
private final ReactiveEntityPersister entityPersister;
14391439

14401440
private LockOptions lockOptions;
14411441
private CacheMode cacheMode;
@@ -1450,7 +1450,7 @@ private class ReactiveMultiIdentifierLoadAccessImpl<T> implements MultiIdLoadOpt
14501450
private boolean readOnly;
14511451

14521452
public ReactiveMultiIdentifierLoadAccessImpl(EntityPersister entityPersister) {
1453-
this.entityPersister = entityPersister;
1453+
this.entityPersister = (ReactiveEntityPersister) entityPersister;
14541454
}
14551455

14561456
@Override
@@ -1489,12 +1489,7 @@ public Integer getBatchSize() {
14891489
}
14901490

14911491
public ReactiveMultiIdentifierLoadAccessImpl<T> withBatchSize(int batchSize) {
1492-
if ( batchSize < 1 ) {
1493-
this.batchSize = null;
1494-
}
1495-
else {
1496-
this.batchSize = batchSize;
1497-
}
1492+
this.batchSize = batchSize < 1 ? null : batchSize;
14981493
return this;
14991494
}
15001495

@@ -1537,8 +1532,11 @@ public CompletionStage<List<T>> multiLoad(Object... ids) {
15371532
Object[] sids = new Object[ids.length];
15381533
System.arraycopy( ids, 0, sids, 0, ids.length );
15391534

1540-
return perform( () -> (CompletionStage) ( (ReactiveEntityPersister) entityPersister )
1541-
.reactiveMultiLoad( sids, ReactiveSessionImpl.this, this ) );
1535+
return perform( () -> {
1536+
final CompletionStage<? extends List<?>> stage =
1537+
entityPersister.reactiveMultiLoad( sids, ReactiveSessionImpl.this, this );
1538+
return (CompletionStage<List<T>>) stage;
1539+
});
15421540
}
15431541

15441542
public CompletionStage<List<T>> perform(Supplier<CompletionStage<List<T>>> executor) {
@@ -1572,12 +1570,6 @@ public CompletionStage<List<T>> perform(Supplier<CompletionStage<List<T>>> execu
15721570
}
15731571
} );
15741572
}
1575-
1576-
@SuppressWarnings("unchecked")
1577-
public <K extends Object> CompletionStage<List<T>> multiLoad(List<K> ids) {
1578-
return perform( () -> (CompletionStage<List<T>>)
1579-
entityPersister.multiLoad( ids.toArray( new Object[0] ), ReactiveSessionImpl.this, this ) );
1580-
}
15811573
}
15821574

15831575
private class NaturalIdLoadAccessImpl<T> {

hibernate-reactive-core/src/main/java/org/hibernate/reactive/session/impl/ReactiveStatelessSessionImpl.java

+9-8
Original file line numberDiff line numberDiff line change
@@ -223,14 +223,15 @@ public <T> CompletionStage<List<T>> reactiveGet(Class<T> entityClass, Object...
223223
Object[] sids = new Object[ids.length];
224224
System.arraycopy( ids, 0, sids, 0, ids.length );
225225

226-
return getEntityPersister( entityClass.getName() )
227-
.reactiveMultiLoad( sids, this, StatelessSessionImpl.MULTI_ID_LOAD_OPTIONS )
228-
.whenComplete( (v, e) -> {
229-
if ( getPersistenceContext().isLoadFinished() ) {
230-
getPersistenceContext().clear();
231-
}
232-
} )
233-
.thenApply( list -> (List<T>) list );
226+
final CompletionStage<? extends List<?>> stage =
227+
getEntityPersister( entityClass.getName() )
228+
.reactiveMultiLoad( sids, this, StatelessSessionImpl.MULTI_ID_LOAD_OPTIONS )
229+
.whenComplete( (v, e) -> {
230+
if ( getPersistenceContext().isLoadFinished() ) {
231+
getPersistenceContext().clear();
232+
}
233+
} );
234+
return (CompletionStage<List<T>>) stage;
234235
}
235236

236237
@Override

0 commit comments

Comments
 (0)