Skip to content

Commit 9656409

Browse files
committed
HSEARCH-5501 Update to Hibernate ORM 7.2.0.CR2
1 parent cba9dd0 commit 9656409

20 files changed

+170
-52
lines changed

bom/platform-common/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<deploy.skip>true</deploy.skip>
1919

2020
<!-- These versions will be checked against the ones resolved by Maven for the project in the enforcer rule -->
21-
<version.bom.org.hibernate.orm>7.1.2.Final</version.bom.org.hibernate.orm>
21+
<version.bom.org.hibernate.orm>7.2.0.CR2</version.bom.org.hibernate.orm>
2222
<version.bom.org.elasticsearch.client>9.2.0</version.bom.org.elasticsearch.client>
2323
<version.bom.software.amazon.awssdk>2.37.3</version.bom.software.amazon.awssdk>
2424
<version.bom.io.smallrye>3.3.1</version.bom.io.smallrye>

build/config/pom.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,8 @@
230230

231231
<argument>^org\.hibernate\.dialect\.lock\.spi\.LockingSupport$</argument>
232232

233+
<argument>^org\.hibernate\.engine\.creation\.CommonBuilder$</argument>
234+
233235
<argument>^org\.hibernate\.metamodel\.MappingMetamodel$</argument>
234236
<argument>^org\.hibernate\.metamodel\.mapping\.Bindable$</argument>
235237
<argument>^org\.hibernate\.metamodel\.mapping\.SelectableMapping$</argument>

build/parents/build/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@
9999
NOTE: when Hibernate ORM updates Byte Buddy, make sure to check Jenkinsfile to see if
100100
`net.bytebuddy.experimental` property can be removed.
101101
-->
102-
<version.org.hibernate.orm>7.1.2.Final</version.org.hibernate.orm>
102+
<version.org.hibernate.orm>7.2.0.CR2</version.org.hibernate.orm>
103103

104104
<javadoc.org.hibernate.orm.url>https://docs.jboss.org/hibernate/orm/${parsed-version.org.hibernate.orm.majorVersion}.${parsed-version.org.hibernate.orm.minorVersion}/javadocs/</javadoc.org.hibernate.orm.url>
105105
<documentation.org.hibernate.orm.url>https://docs.jboss.org/hibernate/orm/${parsed-version.org.hibernate.orm.majorVersion}.${parsed-version.org.hibernate.orm.minorVersion}/userguide/html_single/Hibernate_User_Guide.html</documentation.org.hibernate.orm.url>

mapper/orm/src/main/java/org/hibernate/search/mapper/orm/event/impl/HibernateOrmListenerContextProvider.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
package org.hibernate.search.mapper.orm.event.impl;
66

77
import org.hibernate.engine.spi.SessionImplementor;
8+
import org.hibernate.engine.spi.SharedSessionContractImplementor;
89
import org.hibernate.search.mapper.pojo.model.spi.PojoRawTypeIdentifier;
910
import org.hibernate.search.mapper.pojo.work.spi.ConfiguredIndexingPlanSynchronizationStrategy;
1011
import org.hibernate.search.mapper.pojo.work.spi.PojoIndexingPlan;
@@ -18,7 +19,8 @@ public interface HibernateOrmListenerContextProvider {
1819

1920
PojoIndexingPlan currentIndexingPlanIfExisting(SessionImplementor session);
2021

21-
PojoTypeIndexingPlan currentIndexingPlanIfTypeIncluded(SessionImplementor session, PojoRawTypeIdentifier<?> typeIdentifier);
22+
PojoTypeIndexingPlan currentIndexingPlanIfTypeIncluded(SharedSessionContractImplementor session,
23+
PojoRawTypeIdentifier<?> typeIdentifier);
2224

2325
ConfiguredIndexingPlanSynchronizationStrategy currentAutomaticIndexingSynchronizationStrategy(
2426
SessionImplementor session);

mapper/orm/src/main/java/org/hibernate/search/mapper/orm/event/impl/HibernateSearchEventListener.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import org.hibernate.collection.spi.PersistentCollection;
1111
import org.hibernate.engine.spi.SessionFactoryImplementor;
1212
import org.hibernate.engine.spi.SessionImplementor;
13+
import org.hibernate.engine.spi.SharedSessionContractImplementor;
1314
import org.hibernate.event.service.spi.EventListenerRegistry;
1415
import org.hibernate.event.spi.AbstractCollectionEvent;
1516
import org.hibernate.event.spi.AutoFlushEvent;
@@ -289,7 +290,8 @@ public void onClear(ClearEvent event) {
289290
}
290291
}
291292

292-
private PojoTypeIndexingPlan getCurrentIndexingPlanIfTypeIncluded(SessionImplementor sessionImplementor,
293+
private PojoTypeIndexingPlan getCurrentIndexingPlanIfTypeIncluded(
294+
SharedSessionContractImplementor sessionImplementor,
293295
HibernateOrmListenerTypeContext typeContext) {
294296
return contextProvider.currentIndexingPlanIfTypeIncluded( sessionImplementor, typeContext.typeIdentifier() );
295297
}

mapper/orm/src/main/java/org/hibernate/search/mapper/orm/loading/impl/AbstractHibernateOrmLoadingStrategy.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ public HibernateOrmQueryLoader<E, I> createQueryLoader(SessionFactoryImplementor
209209
}
210210
}
211211

212-
TypeQueryFactory<E, I> actualQueryFactory = createFactory( commonSuperType );
212+
TypeQueryFactory<E, I> actualQueryFactory = createFactory( sessionFactory, commonSuperType );
213213

214214
if ( !conditionalExpressions.isEmpty() || order != null ) {
215215
if ( typeContexts.size() != 1 ) {
@@ -225,13 +225,16 @@ public HibernateOrmQueryLoader<E, I> createQueryLoader(SessionFactoryImplementor
225225
return new HibernateOrmQueryLoaderImpl<>( actualQueryFactory, includedTypesFilter );
226226
}
227227

228-
protected abstract TypeQueryFactory<E, I> createFactory(Class<E> entityClass, String ormEntityName,
228+
protected abstract TypeQueryFactory<E, I> createFactory(
229+
SessionFactoryImplementor sessionFactoryImplementor, Class<E> entityClass, String ormEntityName,
229230
Class<I> uniquePropertyType, String uniquePropertyName);
230231

231232
@SuppressWarnings("unchecked")
232-
protected TypeQueryFactory<E, I> createFactory(EntityMappingType entityMappingType) {
233-
return createFactory( (Class<E>) entityMappingType.getJavaType().getJavaTypeClass(), entityMappingType.getEntityName(),
234-
uniquePropertyType, uniquePropertyName );
233+
protected TypeQueryFactory<E, I> createFactory(SessionFactoryImplementor sessionFactoryImplementor,
234+
EntityMappingType entityMappingType) {
235+
return createFactory( sessionFactoryImplementor, (Class<E>) entityMappingType.getJavaType().getJavaTypeClass(),
236+
entityMappingType.getEntityName(), uniquePropertyType, uniquePropertyName
237+
);
235238
}
236239

237240
protected static EntityMappingType toMostSpecificCommonEntitySuperType(

mapper/orm/src/main/java/org/hibernate/search/mapper/orm/loading/impl/CriteriaTypeQueryFactory.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@
55
package org.hibernate.search.mapper.orm.loading.impl;
66

77
import java.util.Collection;
8+
import java.util.List;
89
import java.util.Set;
910

11+
import jakarta.persistence.FindOption;
1012
import jakarta.persistence.criteria.CriteriaBuilder;
1113
import jakarta.persistence.criteria.CriteriaQuery;
1214
import jakarta.persistence.criteria.ParameterExpression;
@@ -77,8 +79,15 @@ public Query<E> createQueryForLoadByUniqueProperty(SessionImplementor session, S
7779
return session.createQuery( criteriaQuery );
7880
}
7981

82+
@SuppressWarnings("removal")
83+
@Deprecated(forRemoval = true, since = "8.2")
8084
@Override
8185
public MultiIdentifierLoadAccess<E> createMultiIdentifierLoadAccess(SessionImplementor session) {
8286
return session.byMultipleIds( entityClass );
8387
}
88+
89+
@Override
90+
public List<E> findMultiple(SessionImplementor session, List<?> ids, FindOption... options) {
91+
return session.findMultiple( entityClass, ids, options );
92+
}
8493
}

mapper/orm/src/main/java/org/hibernate/search/mapper/orm/loading/impl/HibernateOrmEntityIdEntityLoadingStrategy.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import java.util.Set;
88

99
import org.hibernate.AssertionFailure;
10+
import org.hibernate.engine.spi.SessionFactoryImplementor;
1011
import org.hibernate.mapping.PersistentClass;
1112
import org.hibernate.mapping.RootClass;
1213
import org.hibernate.metamodel.mapping.EntityMappingType;
@@ -89,9 +90,11 @@ public PojoSelectionEntityLoader<E> createEntityLoader(
8990
}
9091

9192
@Override
92-
protected TypeQueryFactory<E, I> createFactory(Class<E> entityClass, String ormEntityName,
93+
protected TypeQueryFactory<E, I> createFactory(
94+
SessionFactoryImplementor sessionFactoryImplementor, Class<E> entityClass, String ormEntityName,
9395
Class<I> uniquePropertyType, String uniquePropertyName) {
94-
return TypeQueryFactory.create( entityClass, ormEntityName, uniquePropertyType, uniquePropertyName, true );
96+
return TypeQueryFactory.create( sessionFactoryImplementor, entityClass, ormEntityName, uniquePropertyType,
97+
uniquePropertyName, true );
9598
}
9699

97100
private PojoSelectionEntityLoader<?> doCreate(EntityMappingType entityMappingType,
@@ -142,7 +145,7 @@ private PojoSelectionEntityLoader<?> doCreate(EntityMappingType entityMappingTyp
142145
// even if we know we actually want instances from the most specific entity type,
143146
// because that exception cannot be recovered from.
144147
return new HibernateOrmSelectionEntityByIdLoader<>( rootEntityMappingType,
145-
createFactory( entityMappingType ),
148+
createFactory( sessionFactory, entityMappingType ),
146149
sessionContext,
147150
persistenceContextLookup, cacheLookupStrategyImplementor, loadingOptions );
148151
}

mapper/orm/src/main/java/org/hibernate/search/mapper/orm/loading/impl/HibernateOrmMassEntityLoader.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,7 @@ public void load(List<I> identifiers) throws InterruptedException {
5555
}
5656

5757
private List<E> multiLoad(List<I> identifiers) {
58-
return typeQueryLoader.createMultiIdentifierLoadAccess( session )
59-
.with( options.cacheMode() )
60-
.with( LockMode.NONE )
61-
.multiLoad( identifiers );
58+
return typeQueryLoader.findMultiple( session, identifiers, options.cacheMode(), LockMode.NONE );
6259
}
6360

6461
private List<E> queryByIds(List<I> identifiers) {

mapper/orm/src/main/java/org/hibernate/search/mapper/orm/loading/impl/HibernateOrmNonEntityIdPropertyEntityLoadingStrategy.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import java.util.Set;
99
import java.util.stream.Collectors;
1010

11+
import org.hibernate.engine.spi.SessionFactoryImplementor;
1112
import org.hibernate.mapping.PersistentClass;
1213
import org.hibernate.search.mapper.orm.common.impl.HibernateOrmUtils;
1314
import org.hibernate.search.mapper.orm.loading.spi.HibernateOrmEntityLoadingStrategy;
@@ -96,10 +97,11 @@ public PojoSelectionEntityLoader<E> createEntityLoader(
9697
}
9798

9899
@Override
99-
protected TypeQueryFactory<E, I> createFactory(Class<E> entityClass, String ormEntityName,
100+
protected TypeQueryFactory<E, I> createFactory(
101+
SessionFactoryImplementor sessionFactoryImplementor, Class<E> entityClass, String ormEntityName,
100102
Class<I> uniquePropertyType, String uniquePropertyName) {
101-
return TypeQueryFactory.create(
102-
entityClass, ormEntityName, uniquePropertyType, uniquePropertyName, uniquePropertyIsTheEntityId );
103+
return TypeQueryFactory.create( sessionFactoryImplementor, entityClass, ormEntityName, uniquePropertyType,
104+
uniquePropertyName, uniquePropertyIsTheEntityId );
103105
}
104106

105107
private PojoSelectionEntityLoader<E> doCreate(PojoLoadingTypeContext<? extends E> targetEntityTypeContext,
@@ -121,7 +123,7 @@ private PojoSelectionEntityLoader<E> doCreate(PojoLoadingTypeContext<? extends E
121123
@SuppressWarnings("unchecked")
122124
PojoSelectionEntityLoader<E> result = new HibernateOrmSelectionEntityByNonIdPropertyLoader<>(
123125
entityMapping, (PojoLoadingTypeContext<E>) targetEntityTypeContext,
124-
createFactory( entityMapping ),
126+
createFactory( sessionFactory, entityMapping ),
125127
documentIdSourcePropertyName, documentIdSourceHandle,
126128
sessionContext, loadingOptions
127129
);

0 commit comments

Comments
 (0)