Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[versions]
assertjVersion = "3.27.6"
hibernateOrmVersion = "7.1.10.Final"
hibernateOrmGradlePluginVersion = "7.1.10.Final"
hibernateOrmVersion = "7.1.11.Final"
hibernateOrmGradlePluginVersion = "7.1.11.Final"
jacksonDatabindVersion = "2.20.1"
jbossLoggingAnnotationVersion = "3.0.4.Final"
jbossLoggingVersion = "3.6.1.Final"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import org.hibernate.metamodel.mapping.internal.ToOneAttributeMapping;
import org.hibernate.persister.entity.EntityPersister;
import org.hibernate.proxy.LazyInitializer;
import org.hibernate.proxy.map.MapProxy;
import org.hibernate.reactive.session.ReactiveQueryProducer;
import org.hibernate.reactive.sql.exec.spi.ReactiveRowProcessingState;
import org.hibernate.reactive.sql.results.graph.ReactiveDomainResultsAssembler;
Expand All @@ -36,15 +35,13 @@
import org.hibernate.sql.results.graph.InitializerParent;
import org.hibernate.sql.results.graph.entity.EntityResultGraphNode;
import org.hibernate.sql.results.graph.entity.internal.EntityInitializerImpl;
import org.hibernate.sql.results.jdbc.spi.JdbcValuesSourceProcessingOptions;
import org.hibernate.sql.results.jdbc.spi.RowProcessingState;
import org.hibernate.stat.spi.StatisticsImplementor;
import org.hibernate.type.Type;

import static org.hibernate.bytecode.enhance.spi.LazyPropertyInitializer.UNFETCHED_PROPERTY;
import static org.hibernate.engine.internal.ManagedTypeHelper.asPersistentAttributeInterceptable;
import static org.hibernate.engine.internal.ManagedTypeHelper.isPersistentAttributeInterceptable;
import static org.hibernate.loader.internal.CacheLoadHelper.loadFromSecondLevelCache;
import static org.hibernate.metamodel.mapping.ForeignKeyDescriptor.Nature.TARGET;
import static org.hibernate.proxy.HibernateProxy.extractLazyInitializer;
import static org.hibernate.reactive.util.impl.CompletionStages.completedFuture;
Expand Down Expand Up @@ -578,47 +575,6 @@ else if ( getEntityDescriptor().canUseReferenceCacheEntries() ) {
}
}

// FIXME: I could change the scope of this method in ORM
private Object resolveToOptionalInstance(ReactiveEntityInitializerData data) {
if ( isResultInitializer() ) {
// this isEntityReturn bit is just for entity loaders, not hql/criteria
final JdbcValuesSourceProcessingOptions processingOptions =
data.getRowProcessingState().getJdbcValuesSourceProcessingState().getProcessingOptions();
return matchesOptionalInstance( data, processingOptions ) ? processingOptions.getEffectiveOptionalObject() : null;
}
else {
return null;
}
}

// FIXME: I could change the scope of this method in ORM
private boolean isProxyInstance(Object proxy) {
return proxy != null
&& ( proxy instanceof MapProxy || getEntityDescriptor().getJavaType().getJavaTypeClass().isInstance( proxy ) );
}

// FIXME: I could change the scope of this method in ORM
private Object resolveInstanceFromCache(ReactiveEntityInitializerData data) {
return loadFromSecondLevelCache(
data.getRowProcessingState().getSession().asEventSource(),
null,
data.getLockMode(),
getEntityDescriptor(),
data.getEntityKey()
);
}

// FIXME: I could change the scope of this method in ORM
private boolean matchesOptionalInstance(
ReactiveEntityInitializerData data,
JdbcValuesSourceProcessingOptions processingOptions) {
final Object optionalEntityInstance = processingOptions.getEffectiveOptionalObject();
final Object requestedEntityId = processingOptions.getEffectiveOptionalId();
return requestedEntityId != null
&& optionalEntityInstance != null
&& requestedEntityId.equals( data.getEntityKey().getIdentifier() );
}

private boolean isExistingEntityInitialized(Object existingEntity) {
return Hibernate.isInitialized( existingEntity );
}
Expand Down