|
23 | 23 | import org.hibernate.metamodel.mapping.internal.ToOneAttributeMapping; |
24 | 24 | import org.hibernate.persister.entity.EntityPersister; |
25 | 25 | import org.hibernate.proxy.LazyInitializer; |
26 | | -import org.hibernate.proxy.map.MapProxy; |
27 | 26 | import org.hibernate.reactive.session.ReactiveQueryProducer; |
28 | 27 | import org.hibernate.reactive.sql.exec.spi.ReactiveRowProcessingState; |
29 | 28 | import org.hibernate.reactive.sql.results.graph.ReactiveDomainResultsAssembler; |
|
45 | 44 | import static org.hibernate.bytecode.enhance.spi.LazyPropertyInitializer.UNFETCHED_PROPERTY; |
46 | 45 | import static org.hibernate.engine.internal.ManagedTypeHelper.asPersistentAttributeInterceptable; |
47 | 46 | import static org.hibernate.engine.internal.ManagedTypeHelper.isPersistentAttributeInterceptable; |
48 | | -import static org.hibernate.loader.internal.CacheLoadHelper.loadFromSecondLevelCache; |
49 | 47 | import static org.hibernate.metamodel.mapping.ForeignKeyDescriptor.Nature.TARGET; |
50 | 48 | import static org.hibernate.proxy.HibernateProxy.extractLazyInitializer; |
51 | 49 | import static org.hibernate.reactive.util.impl.CompletionStages.completedFuture; |
@@ -143,11 +141,7 @@ public ReactiveEntityInitializerImpl( |
143 | 141 | protected void resolveEntityKey(EntityInitializerData original, Object id) { |
144 | 142 | ReactiveEntityInitializerData data = (ReactiveEntityInitializerData) original; |
145 | 143 | if ( data.getConcreteDescriptor() == null ) { |
146 | | - data.setConcreteDescriptor( determineConcreteEntityDescriptor( |
147 | | - data.getRowProcessingState(), |
148 | | - getDiscriminatorAssembler(), |
149 | | - getEntityDescriptor() |
150 | | - ) ); |
| 144 | + data.setConcreteDescriptor( determineConcreteEntityDescriptor( data.getRowProcessingState(), discriminatorAssembler(), getEntityDescriptor() ) ); |
151 | 145 | assert data.getConcreteDescriptor() != null; |
152 | 146 | } |
153 | 147 | data.setEntityKey( new EntityKey( id, data.getConcreteDescriptor() ) ); |
@@ -186,9 +180,9 @@ assert getInitializedPart() instanceof ToOneAttributeMapping |
186 | 180 | else if ( lazyInitializer.isUninitialized() ) { |
187 | 181 | data.setState( State.RESOLVED ); |
188 | 182 | // Read the discriminator from the result set if necessary |
189 | | - EntityPersister persister = getDiscriminatorAssembler() == null |
| 183 | + EntityPersister persister = discriminatorAssembler() == null |
190 | 184 | ? getEntityDescriptor() |
191 | | - : determineConcreteEntityDescriptor( rowProcessingState, getDiscriminatorAssembler(), getEntityDescriptor() ); |
| 185 | + : determineConcreteEntityDescriptor( rowProcessingState, discriminatorAssembler(), getEntityDescriptor() ); |
192 | 186 | data.setConcreteDescriptor( persister ); |
193 | 187 | assert data.getConcreteDescriptor() != null; |
194 | 188 | resolveEntityKey( data, lazyInitializer.getIdentifier() ); |
@@ -592,34 +586,6 @@ private Object resolveToOptionalInstance(ReactiveEntityInitializerData data) { |
592 | 586 | } |
593 | 587 | } |
594 | 588 |
|
595 | | - // FIXME: I could change the scope of this method in ORM |
596 | | - private boolean isProxyInstance(Object proxy) { |
597 | | - return proxy != null |
598 | | - && ( proxy instanceof MapProxy || getEntityDescriptor().getJavaType().getJavaTypeClass().isInstance( proxy ) ); |
599 | | - } |
600 | | - |
601 | | - // FIXME: I could change the scope of this method in ORM |
602 | | - private Object resolveInstanceFromCache(ReactiveEntityInitializerData data) { |
603 | | - return loadFromSecondLevelCache( |
604 | | - data.getRowProcessingState().getSession().asEventSource(), |
605 | | - null, |
606 | | - data.getLockMode(), |
607 | | - getEntityDescriptor(), |
608 | | - data.getEntityKey() |
609 | | - ); |
610 | | - } |
611 | | - |
612 | | - // FIXME: I could change the scope of this method in ORM |
613 | | - private boolean matchesOptionalInstance( |
614 | | - ReactiveEntityInitializerData data, |
615 | | - JdbcValuesSourceProcessingOptions processingOptions) { |
616 | | - final Object optionalEntityInstance = processingOptions.getEffectiveOptionalObject(); |
617 | | - final Object requestedEntityId = processingOptions.getEffectiveOptionalId(); |
618 | | - return requestedEntityId != null |
619 | | - && optionalEntityInstance != null |
620 | | - && requestedEntityId.equals( data.getEntityKey().getIdentifier() ); |
621 | | - } |
622 | | - |
623 | 589 | private boolean isExistingEntityInitialized(Object existingEntity) { |
624 | 590 | return Hibernate.isInitialized( existingEntity ); |
625 | 591 | } |
@@ -779,7 +745,7 @@ private CompletionStage<Boolean> initializeId(ReactiveEntityInitializerData data |
779 | 745 | else { |
780 | 746 | data.setConcreteDescriptor( determineConcreteEntityDescriptor( |
781 | 747 | rowProcessingState, |
782 | | - getDiscriminatorAssembler(), |
| 748 | + discriminatorAssembler(), |
783 | 749 | getEntityDescriptor() |
784 | 750 | ) ); |
785 | 751 | assert data.getConcreteDescriptor() != null; |
|
0 commit comments