Skip to content

Commit

Permalink
HSEARCH-3277 Remove the casts of IDs to Serializable where possible
Browse files Browse the repository at this point in the history
  • Loading branch information
yrodiere committed Sep 29, 2023
1 parent 6644fda commit ed7b733
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
Expand Up @@ -6,7 +6,6 @@
*/
package org.hibernate.search.mapper.orm.loading.impl;

import java.io.Serializable;
import java.util.List;

import org.hibernate.FlushMode;
Expand Down Expand Up @@ -56,12 +55,11 @@ public void load(List<I> identifiers) throws InterruptedException {
transactionHelper.commit( session );
}

@SuppressWarnings("unchecked") // We can assume identifiers are serializable
private List<E> multiLoad(List<I> identifiers) {
return typeQueryLoader.createMultiIdentifierLoadAccess( session )
.with( options.cacheMode() )
.with( LockOptions.NONE )
.multiLoad( (List<Serializable>) identifiers );
.multiLoad( identifiers );
}

private List<E> queryByIds(List<I> identifiers) {
Expand Down
Expand Up @@ -6,7 +6,6 @@
*/
package org.hibernate.search.mapper.orm.loading.impl;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

Expand Down Expand Up @@ -87,7 +86,7 @@ protected List<E> doLoadEntities(List<?> allIds, Long timeout) {
private EntityKey[] toEntityKeys(List<?> ids) {
EntityKey[] entityKeys = new EntityKey[ids.size()];
for ( int i = 0; i < ids.size(); i++ ) {
Serializable id = (Serializable) ids.get( i );
Object id = ids.get( i );
EntityKey entityKey = sessionContext.session().generateEntityKey( id, entityPersister );
entityKeys[i] = ( entityKey );
}
Expand Down

0 comments on commit ed7b733

Please sign in to comment.