HHH-18847 - Organize the org.hibernate.query.results package
This commit is contained in:
parent
2c5e0ff113
commit
6707dee0a6
|
@ -4,13 +4,10 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.generator.values;
|
package org.hibernate.generator.values;
|
||||||
|
|
||||||
import java.util.function.BiFunction;
|
|
||||||
|
|
||||||
import org.hibernate.metamodel.mapping.BasicValuedModelPart;
|
import org.hibernate.metamodel.mapping.BasicValuedModelPart;
|
||||||
import org.hibernate.query.results.DomainResultCreationStateImpl;
|
|
||||||
import org.hibernate.query.results.ResultBuilder;
|
import org.hibernate.query.results.ResultBuilder;
|
||||||
import org.hibernate.query.results.ResultsHelper;
|
import org.hibernate.query.results.internal.DomainResultCreationStateImpl;
|
||||||
import org.hibernate.query.results.dynamic.DynamicFetchBuilderLegacy;
|
import org.hibernate.query.results.internal.ResultsHelper;
|
||||||
import org.hibernate.spi.NavigablePath;
|
import org.hibernate.spi.NavigablePath;
|
||||||
import org.hibernate.sql.ast.spi.SqlSelection;
|
import org.hibernate.sql.ast.spi.SqlSelection;
|
||||||
import org.hibernate.sql.ast.tree.from.TableGroup;
|
import org.hibernate.sql.ast.tree.from.TableGroup;
|
||||||
|
@ -20,8 +17,8 @@ import org.hibernate.sql.results.graph.basic.BasicResult;
|
||||||
import org.hibernate.sql.results.jdbc.spi.JdbcValuesMetadata;
|
import org.hibernate.sql.results.jdbc.spi.JdbcValuesMetadata;
|
||||||
|
|
||||||
import static org.hibernate.generator.values.internal.GeneratedValuesHelper.getActualGeneratedModelPart;
|
import static org.hibernate.generator.values.internal.GeneratedValuesHelper.getActualGeneratedModelPart;
|
||||||
import static org.hibernate.query.results.ResultsHelper.impl;
|
import static org.hibernate.query.results.internal.ResultsHelper.impl;
|
||||||
import static org.hibernate.query.results.ResultsHelper.jdbcPositionToValuesArrayPosition;
|
import static org.hibernate.query.results.internal.ResultsHelper.jdbcPositionToValuesArrayPosition;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Simple implementation of {@link ResultBuilder} for retrieving generated basic values.
|
* Simple implementation of {@link ResultBuilder} for retrieving generated basic values.
|
||||||
|
@ -60,7 +57,6 @@ public class GeneratedValueBasicResultBuilder implements ResultBuilder {
|
||||||
public BasicResult<?> buildResult(
|
public BasicResult<?> buildResult(
|
||||||
JdbcValuesMetadata jdbcResultsMetadata,
|
JdbcValuesMetadata jdbcResultsMetadata,
|
||||||
int resultPosition,
|
int resultPosition,
|
||||||
BiFunction<String, String, DynamicFetchBuilderLegacy> legacyFetchResolver,
|
|
||||||
DomainResultCreationState domainResultCreationState) {
|
DomainResultCreationState domainResultCreationState) {
|
||||||
final DomainResultCreationStateImpl creationStateImpl = impl( domainResultCreationState );
|
final DomainResultCreationStateImpl creationStateImpl = impl( domainResultCreationState );
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ import org.hibernate.metamodel.mapping.SelectableMapping;
|
||||||
import org.hibernate.persister.entity.EntityPersister;
|
import org.hibernate.persister.entity.EntityPersister;
|
||||||
import org.hibernate.persister.entity.mutation.EntityTableMapping;
|
import org.hibernate.persister.entity.mutation.EntityTableMapping;
|
||||||
import org.hibernate.pretty.MessageHelper;
|
import org.hibernate.pretty.MessageHelper;
|
||||||
import org.hibernate.query.results.TableGroupImpl;
|
import org.hibernate.query.results.internal.TableGroupImpl;
|
||||||
import org.hibernate.query.spi.QueryOptions;
|
import org.hibernate.query.spi.QueryOptions;
|
||||||
import org.hibernate.spi.NavigablePath;
|
import org.hibernate.spi.NavigablePath;
|
||||||
import org.hibernate.sql.ast.tree.from.NamedTableReference;
|
import org.hibernate.sql.ast.tree.from.NamedTableReference;
|
||||||
|
|
|
@ -12,8 +12,8 @@ import org.hibernate.engine.spi.LoadQueryInfluencers;
|
||||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
import org.hibernate.generator.values.GeneratedValueBasicResultBuilder;
|
import org.hibernate.generator.values.GeneratedValueBasicResultBuilder;
|
||||||
import org.hibernate.generator.values.GeneratedValuesMutationDelegate;
|
import org.hibernate.generator.values.GeneratedValuesMutationDelegate;
|
||||||
import org.hibernate.query.results.DomainResultCreationStateImpl;
|
import org.hibernate.query.results.internal.DomainResultCreationStateImpl;
|
||||||
import org.hibernate.query.results.JdbcValuesMappingImpl;
|
import org.hibernate.query.results.internal.JdbcValuesMappingImpl;
|
||||||
import org.hibernate.query.results.ResultBuilder;
|
import org.hibernate.query.results.ResultBuilder;
|
||||||
import org.hibernate.sql.ast.spi.SqlSelection;
|
import org.hibernate.sql.ast.spi.SqlSelection;
|
||||||
import org.hibernate.sql.results.graph.DomainResult;
|
import org.hibernate.sql.results.graph.DomainResult;
|
||||||
|
@ -57,7 +57,6 @@ public class GeneratedValuesMappingProducer implements JdbcValuesMappingProducer
|
||||||
final DomainResult<?> domainResult = resultBuilder.buildResult(
|
final DomainResult<?> domainResult = resultBuilder.buildResult(
|
||||||
jdbcResultsMetadata,
|
jdbcResultsMetadata,
|
||||||
domainResults.size(),
|
domainResults.size(),
|
||||||
creationState.getLegacyFetchResolver()::resolve,
|
|
||||||
creationState
|
creationState
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -86,7 +86,7 @@ import org.hibernate.sql.results.internal.StandardEntityGraphTraversalStateImpl;
|
||||||
import org.jboss.logging.Logger;
|
import org.jboss.logging.Logger;
|
||||||
|
|
||||||
import static java.util.Collections.singletonList;
|
import static java.util.Collections.singletonList;
|
||||||
import static org.hibernate.query.results.ResultsHelper.attributeName;
|
import static org.hibernate.query.results.internal.ResultsHelper.attributeName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Builder for SQL AST trees used by {@link Loader} implementations.
|
* Builder for SQL AST trees used by {@link Loader} implementations.
|
||||||
|
|
|
@ -4,17 +4,14 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.procedure.internal;
|
package org.hibernate.procedure.internal;
|
||||||
|
|
||||||
import java.util.function.BiFunction;
|
|
||||||
|
|
||||||
import org.hibernate.LockMode;
|
import org.hibernate.LockMode;
|
||||||
import org.hibernate.metamodel.mapping.EntityDiscriminatorMapping;
|
import org.hibernate.metamodel.mapping.EntityDiscriminatorMapping;
|
||||||
import org.hibernate.metamodel.mapping.EntityMappingType;
|
import org.hibernate.metamodel.mapping.EntityMappingType;
|
||||||
import org.hibernate.spi.NavigablePath;
|
import org.hibernate.query.results.FetchBuilderBasicValued;
|
||||||
import org.hibernate.query.results.BasicValuedFetchBuilder;
|
|
||||||
import org.hibernate.query.results.ResultBuilder;
|
import org.hibernate.query.results.ResultBuilder;
|
||||||
import org.hibernate.query.results.complete.EntityResultImpl;
|
import org.hibernate.query.results.internal.complete.EntityResultImpl;
|
||||||
import org.hibernate.query.results.dynamic.DynamicFetchBuilderLegacy;
|
import org.hibernate.query.results.internal.implicit.ImplicitFetchBuilderBasic;
|
||||||
import org.hibernate.query.results.implicit.ImplicitFetchBuilderBasic;
|
import org.hibernate.spi.NavigablePath;
|
||||||
import org.hibernate.sql.results.graph.DomainResultCreationState;
|
import org.hibernate.sql.results.graph.DomainResultCreationState;
|
||||||
import org.hibernate.sql.results.graph.entity.EntityResult;
|
import org.hibernate.sql.results.graph.entity.EntityResult;
|
||||||
import org.hibernate.sql.results.jdbc.spi.JdbcValuesMetadata;
|
import org.hibernate.sql.results.jdbc.spi.JdbcValuesMetadata;
|
||||||
|
@ -26,7 +23,7 @@ public class EntityDomainResultBuilder implements ResultBuilder {
|
||||||
|
|
||||||
private final NavigablePath navigablePath;
|
private final NavigablePath navigablePath;
|
||||||
private final EntityMappingType entityDescriptor;
|
private final EntityMappingType entityDescriptor;
|
||||||
private final BasicValuedFetchBuilder discriminatorFetchBuilder;
|
private final FetchBuilderBasicValued discriminatorFetchBuilder;
|
||||||
|
|
||||||
public EntityDomainResultBuilder(EntityMappingType entityDescriptor) {
|
public EntityDomainResultBuilder(EntityMappingType entityDescriptor) {
|
||||||
this.entityDescriptor = entityDescriptor;
|
this.entityDescriptor = entityDescriptor;
|
||||||
|
@ -57,7 +54,6 @@ public class EntityDomainResultBuilder implements ResultBuilder {
|
||||||
public EntityResult buildResult(
|
public EntityResult buildResult(
|
||||||
JdbcValuesMetadata jdbcResultsMetadata,
|
JdbcValuesMetadata jdbcResultsMetadata,
|
||||||
int resultPosition,
|
int resultPosition,
|
||||||
BiFunction<String, String, DynamicFetchBuilderLegacy> legacyFetchResolver,
|
|
||||||
DomainResultCreationState domainResultCreationState) {
|
DomainResultCreationState domainResultCreationState) {
|
||||||
|
|
||||||
return new EntityResultImpl(
|
return new EntityResultImpl(
|
||||||
|
@ -73,7 +69,6 @@ public class EntityDomainResultBuilder implements ResultBuilder {
|
||||||
entityResult,
|
entityResult,
|
||||||
navigablePath.append( EntityDiscriminatorMapping.DISCRIMINATOR_ROLE_NAME ),
|
navigablePath.append( EntityDiscriminatorMapping.DISCRIMINATOR_ROLE_NAME ),
|
||||||
jdbcResultsMetadata,
|
jdbcResultsMetadata,
|
||||||
legacyFetchResolver,
|
|
||||||
domainResultCreationState
|
domainResultCreationState
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
|
@ -4,12 +4,9 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.procedure.internal;
|
package org.hibernate.procedure.internal;
|
||||||
|
|
||||||
import java.util.function.BiFunction;
|
|
||||||
|
|
||||||
import org.hibernate.metamodel.mapping.BasicValuedMapping;
|
import org.hibernate.metamodel.mapping.BasicValuedMapping;
|
||||||
import org.hibernate.query.results.ResultBuilder;
|
import org.hibernate.query.results.ResultBuilder;
|
||||||
import org.hibernate.query.results.ResultSetMappingSqlSelection;
|
import org.hibernate.query.results.internal.ResultSetMappingSqlSelection;
|
||||||
import org.hibernate.query.results.dynamic.DynamicFetchBuilderLegacy;
|
|
||||||
import org.hibernate.sql.ast.spi.SqlExpressionResolver;
|
import org.hibernate.sql.ast.spi.SqlExpressionResolver;
|
||||||
import org.hibernate.sql.ast.spi.SqlSelection;
|
import org.hibernate.sql.ast.spi.SqlSelection;
|
||||||
import org.hibernate.sql.results.graph.DomainResult;
|
import org.hibernate.sql.results.graph.DomainResult;
|
||||||
|
@ -38,7 +35,6 @@ public class ScalarDomainResultBuilder<T> implements ResultBuilder {
|
||||||
public DomainResult<T> buildResult(
|
public DomainResult<T> buildResult(
|
||||||
JdbcValuesMetadata jdbcResultsMetadata,
|
JdbcValuesMetadata jdbcResultsMetadata,
|
||||||
int resultPosition,
|
int resultPosition,
|
||||||
BiFunction<String, String, DynamicFetchBuilderLegacy> legacyFetchResolver,
|
|
||||||
DomainResultCreationState domainResultCreationState) {
|
DomainResultCreationState domainResultCreationState) {
|
||||||
final SqlExpressionResolver sqlExpressionResolver = domainResultCreationState.getSqlAstCreationState()
|
final SqlExpressionResolver sqlExpressionResolver = domainResultCreationState.getSqlAstCreationState()
|
||||||
.getSqlExpressionResolver();
|
.getSqlExpressionResolver();
|
||||||
|
|
|
@ -4,12 +4,6 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.query;
|
package org.hibernate.query;
|
||||||
|
|
||||||
import java.time.Instant;
|
|
||||||
import java.util.Calendar;
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import jakarta.persistence.AttributeConverter;
|
import jakarta.persistence.AttributeConverter;
|
||||||
import jakarta.persistence.CacheRetrieveMode;
|
import jakarta.persistence.CacheRetrieveMode;
|
||||||
import jakarta.persistence.CacheStoreMode;
|
import jakarta.persistence.CacheStoreMode;
|
||||||
|
@ -18,7 +12,6 @@ import jakarta.persistence.LockModeType;
|
||||||
import jakarta.persistence.Parameter;
|
import jakarta.persistence.Parameter;
|
||||||
import jakarta.persistence.TemporalType;
|
import jakarta.persistence.TemporalType;
|
||||||
import jakarta.persistence.metamodel.SingularAttribute;
|
import jakarta.persistence.metamodel.SingularAttribute;
|
||||||
|
|
||||||
import org.hibernate.CacheMode;
|
import org.hibernate.CacheMode;
|
||||||
import org.hibernate.FlushMode;
|
import org.hibernate.FlushMode;
|
||||||
import org.hibernate.LockMode;
|
import org.hibernate.LockMode;
|
||||||
|
@ -31,6 +24,12 @@ import org.hibernate.spi.NavigablePath;
|
||||||
import org.hibernate.transform.ResultTransformer;
|
import org.hibernate.transform.ResultTransformer;
|
||||||
import org.hibernate.type.BasicTypeReference;
|
import org.hibernate.type.BasicTypeReference;
|
||||||
|
|
||||||
|
import java.time.Instant;
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Within the context of an active {@linkplain org.hibernate.Session session},
|
* Within the context of an active {@linkplain org.hibernate.Session session},
|
||||||
* an instance of this type represents an executable query written in the
|
* an instance of this type represents an executable query written in the
|
||||||
|
|
|
@ -10,7 +10,7 @@ import org.hibernate.metamodel.mapping.BasicValuedModelPart;
|
||||||
import org.hibernate.spi.NavigablePath;
|
import org.hibernate.spi.NavigablePath;
|
||||||
import org.hibernate.query.named.FetchMementoBasic;
|
import org.hibernate.query.named.FetchMementoBasic;
|
||||||
import org.hibernate.query.results.FetchBuilder;
|
import org.hibernate.query.results.FetchBuilder;
|
||||||
import org.hibernate.query.results.complete.CompleteFetchBuilderBasicPart;
|
import org.hibernate.query.results.internal.complete.CompleteFetchBuilderBasicPart;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Memento describing a basic-valued fetch. A basic-value cannot be
|
* Memento describing a basic-valued fetch. A basic-value cannot be
|
||||||
|
|
|
@ -10,7 +10,7 @@ import java.util.function.Consumer;
|
||||||
import org.hibernate.metamodel.mapping.EmbeddableValuedModelPart;
|
import org.hibernate.metamodel.mapping.EmbeddableValuedModelPart;
|
||||||
import org.hibernate.query.named.FetchMemento;
|
import org.hibernate.query.named.FetchMemento;
|
||||||
import org.hibernate.query.results.FetchBuilder;
|
import org.hibernate.query.results.FetchBuilder;
|
||||||
import org.hibernate.query.results.complete.CompleteFetchBuilderEmbeddableValuedModelPart;
|
import org.hibernate.query.results.internal.complete.CompleteFetchBuilderEmbeddableValuedModelPart;
|
||||||
import org.hibernate.spi.NavigablePath;
|
import org.hibernate.spi.NavigablePath;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -10,7 +10,7 @@ import java.util.function.Consumer;
|
||||||
import org.hibernate.spi.NavigablePath;
|
import org.hibernate.spi.NavigablePath;
|
||||||
import org.hibernate.query.named.FetchMemento;
|
import org.hibernate.query.named.FetchMemento;
|
||||||
import org.hibernate.query.results.FetchBuilder;
|
import org.hibernate.query.results.FetchBuilder;
|
||||||
import org.hibernate.query.results.complete.CompleteFetchBuilderEntityValuedModelPart;
|
import org.hibernate.query.results.internal.complete.CompleteFetchBuilderEntityValuedModelPart;
|
||||||
import org.hibernate.sql.results.graph.entity.EntityValuedFetchable;
|
import org.hibernate.sql.results.graph.entity.EntityValuedFetchable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -14,13 +14,13 @@ import org.hibernate.metamodel.mapping.CollectionPart;
|
||||||
import org.hibernate.metamodel.mapping.EntityMappingType;
|
import org.hibernate.metamodel.mapping.EntityMappingType;
|
||||||
import org.hibernate.metamodel.mapping.PluralAttributeMapping;
|
import org.hibernate.metamodel.mapping.PluralAttributeMapping;
|
||||||
import org.hibernate.metamodel.mapping.internal.ToOneAttributeMapping;
|
import org.hibernate.metamodel.mapping.internal.ToOneAttributeMapping;
|
||||||
import org.hibernate.query.results.complete.CompleteFetchBuilderEntityValuedModelPart;
|
import org.hibernate.query.results.internal.complete.CompleteFetchBuilderEntityValuedModelPart;
|
||||||
import org.hibernate.query.results.dynamic.DynamicFetchBuilder;
|
import org.hibernate.query.results.internal.dynamic.DynamicFetchBuilder;
|
||||||
import org.hibernate.query.results.dynamic.DynamicResultBuilderEntityStandard;
|
import org.hibernate.query.results.internal.dynamic.DynamicResultBuilderEntityStandard;
|
||||||
import org.hibernate.spi.NavigablePath;
|
import org.hibernate.spi.NavigablePath;
|
||||||
import org.hibernate.query.named.FetchMemento;
|
import org.hibernate.query.named.FetchMemento;
|
||||||
import org.hibernate.query.results.FetchBuilder;
|
import org.hibernate.query.results.FetchBuilder;
|
||||||
import org.hibernate.query.results.dynamic.DynamicFetchBuilderLegacy;
|
import org.hibernate.query.results.internal.dynamic.DynamicFetchBuilderLegacy;
|
||||||
import org.hibernate.sql.results.graph.Fetchable;
|
import org.hibernate.sql.results.graph.Fetchable;
|
||||||
import org.hibernate.sql.results.graph.FetchableContainer;
|
import org.hibernate.sql.results.graph.FetchableContainer;
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ import org.hibernate.metamodel.mapping.AttributeMapping;
|
||||||
import org.hibernate.spi.NavigablePath;
|
import org.hibernate.spi.NavigablePath;
|
||||||
import org.hibernate.query.named.FetchMemento;
|
import org.hibernate.query.named.FetchMemento;
|
||||||
import org.hibernate.query.results.FetchBuilder;
|
import org.hibernate.query.results.FetchBuilder;
|
||||||
import org.hibernate.query.results.ImplicitAttributeFetchBuilder;
|
import org.hibernate.query.results.internal.implicit.ImplicitAttributeFetchBuilder;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
|
|
|
@ -12,9 +12,9 @@ import org.hibernate.metamodel.mapping.EntityValuedModelPart;
|
||||||
import org.hibernate.metamodel.mapping.ModelPart;
|
import org.hibernate.metamodel.mapping.ModelPart;
|
||||||
import org.hibernate.spi.NavigablePath;
|
import org.hibernate.spi.NavigablePath;
|
||||||
import org.hibernate.query.named.ModelPartResultMemento;
|
import org.hibernate.query.named.ModelPartResultMemento;
|
||||||
import org.hibernate.query.results.implicit.ImplicitModelPartResultBuilderBasic;
|
import org.hibernate.query.results.internal.implicit.ImplicitModelPartResultBuilderBasic;
|
||||||
import org.hibernate.query.results.implicit.ImplicitModelPartResultBuilderEmbeddable;
|
import org.hibernate.query.results.internal.implicit.ImplicitModelPartResultBuilderEmbeddable;
|
||||||
import org.hibernate.query.results.implicit.ImplicitModelPartResultBuilderEntity;
|
import org.hibernate.query.results.internal.implicit.ImplicitModelPartResultBuilderEntity;
|
||||||
import org.hibernate.query.results.ResultBuilder;
|
import org.hibernate.query.results.ResultBuilder;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -10,7 +10,7 @@ import org.hibernate.metamodel.mapping.BasicValuedModelPart;
|
||||||
import org.hibernate.spi.NavigablePath;
|
import org.hibernate.spi.NavigablePath;
|
||||||
import org.hibernate.query.named.ModelPartResultMementoBasic;
|
import org.hibernate.query.named.ModelPartResultMementoBasic;
|
||||||
import org.hibernate.query.results.ResultBuilderBasicValued;
|
import org.hibernate.query.results.ResultBuilderBasicValued;
|
||||||
import org.hibernate.query.results.complete.CompleteResultBuilderBasicModelPart;
|
import org.hibernate.query.results.internal.complete.CompleteResultBuilderBasicModelPart;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
|
|
|
@ -12,8 +12,8 @@ import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
import org.hibernate.metamodel.mapping.BasicValuedMapping;
|
import org.hibernate.metamodel.mapping.BasicValuedMapping;
|
||||||
import org.hibernate.query.named.ResultMementoBasic;
|
import org.hibernate.query.named.ResultMementoBasic;
|
||||||
import org.hibernate.query.results.ResultBuilderBasicValued;
|
import org.hibernate.query.results.ResultBuilderBasicValued;
|
||||||
import org.hibernate.query.results.complete.CompleteResultBuilderBasicValuedConverted;
|
import org.hibernate.query.results.internal.complete.CompleteResultBuilderBasicValuedConverted;
|
||||||
import org.hibernate.query.results.complete.CompleteResultBuilderBasicValuedStandard;
|
import org.hibernate.query.results.internal.complete.CompleteResultBuilderBasicValuedStandard;
|
||||||
import org.hibernate.resource.beans.spi.ManagedBean;
|
import org.hibernate.resource.beans.spi.ManagedBean;
|
||||||
import org.hibernate.resource.beans.spi.ManagedBeanRegistry;
|
import org.hibernate.resource.beans.spi.ManagedBeanRegistry;
|
||||||
import org.hibernate.type.BasicType;
|
import org.hibernate.type.BasicType;
|
||||||
|
|
|
@ -10,7 +10,7 @@ import org.hibernate.metamodel.mapping.PluralAttributeMapping;
|
||||||
import org.hibernate.spi.NavigablePath;
|
import org.hibernate.spi.NavigablePath;
|
||||||
import org.hibernate.query.named.ModelPartResultMementoCollection;
|
import org.hibernate.query.named.ModelPartResultMementoCollection;
|
||||||
import org.hibernate.query.results.ResultBuilder;
|
import org.hibernate.query.results.ResultBuilder;
|
||||||
import org.hibernate.query.results.complete.CompleteResultBuilderCollectionStandard;
|
import org.hibernate.query.results.internal.complete.CompleteResultBuilderCollectionStandard;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
|
|
|
@ -16,12 +16,12 @@ import org.hibernate.metamodel.mapping.EntityMappingType;
|
||||||
import org.hibernate.query.named.FetchMemento;
|
import org.hibernate.query.named.FetchMemento;
|
||||||
import org.hibernate.query.named.FetchMementoBasic;
|
import org.hibernate.query.named.FetchMementoBasic;
|
||||||
import org.hibernate.query.named.ResultMementoEntity;
|
import org.hibernate.query.named.ResultMementoEntity;
|
||||||
import org.hibernate.query.results.BasicValuedFetchBuilder;
|
import org.hibernate.query.results.FetchBuilderBasicValued;
|
||||||
import org.hibernate.query.results.FetchBuilder;
|
import org.hibernate.query.results.FetchBuilder;
|
||||||
import org.hibernate.query.results.ResultBuilderEntityValued;
|
import org.hibernate.query.results.ResultBuilderEntityValued;
|
||||||
import org.hibernate.query.results.complete.CompleteResultBuilderEntityJpa;
|
import org.hibernate.query.results.internal.complete.CompleteResultBuilderEntityJpa;
|
||||||
import org.hibernate.query.results.complete.DelayedFetchBuilderBasicPart;
|
import org.hibernate.query.results.internal.complete.DelayedFetchBuilderBasicPart;
|
||||||
import org.hibernate.query.results.implicit.ImplicitFetchBuilderBasic;
|
import org.hibernate.query.results.internal.implicit.ImplicitFetchBuilderBasic;
|
||||||
import org.hibernate.spi.NavigablePath;
|
import org.hibernate.spi.NavigablePath;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -56,14 +56,14 @@ public class ResultMementoEntityJpa implements ResultMementoEntity, FetchMemento
|
||||||
Consumer<String> querySpaceConsumer,
|
Consumer<String> querySpaceConsumer,
|
||||||
ResultSetMappingResolutionContext context) {
|
ResultSetMappingResolutionContext context) {
|
||||||
final EntityDiscriminatorMapping discriminatorMapping = entityDescriptor.getDiscriminatorMapping();
|
final EntityDiscriminatorMapping discriminatorMapping = entityDescriptor.getDiscriminatorMapping();
|
||||||
final BasicValuedFetchBuilder discriminatorFetchBuilder;
|
final FetchBuilderBasicValued discriminatorFetchBuilder;
|
||||||
if ( discriminatorMapping == null || !entityDescriptor.hasSubclasses() ) {
|
if ( discriminatorMapping == null || !entityDescriptor.hasSubclasses() ) {
|
||||||
assert discriminatorMemento == null;
|
assert discriminatorMemento == null;
|
||||||
discriminatorFetchBuilder = null;
|
discriminatorFetchBuilder = null;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if ( discriminatorMemento != null ) {
|
if ( discriminatorMemento != null ) {
|
||||||
discriminatorFetchBuilder = (BasicValuedFetchBuilder) discriminatorMemento.resolve( this, querySpaceConsumer, context );
|
discriminatorFetchBuilder = (FetchBuilderBasicValued) discriminatorMemento.resolve( this, querySpaceConsumer, context );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
discriminatorFetchBuilder = new ImplicitFetchBuilderBasic( navigablePath, discriminatorMapping );
|
discriminatorFetchBuilder = new ImplicitFetchBuilderBasic( navigablePath, discriminatorMapping );
|
||||||
|
|
|
@ -15,10 +15,10 @@ import org.hibernate.query.QueryLogging;
|
||||||
import org.hibernate.query.named.FetchMemento;
|
import org.hibernate.query.named.FetchMemento;
|
||||||
import org.hibernate.query.named.FetchMementoBasic;
|
import org.hibernate.query.named.FetchMementoBasic;
|
||||||
import org.hibernate.query.named.ResultMementoEntity;
|
import org.hibernate.query.named.ResultMementoEntity;
|
||||||
import org.hibernate.query.results.BasicValuedFetchBuilder;
|
import org.hibernate.query.results.FetchBuilderBasicValued;
|
||||||
import org.hibernate.query.results.FetchBuilder;
|
import org.hibernate.query.results.FetchBuilder;
|
||||||
import org.hibernate.query.results.ResultBuilderEntityValued;
|
import org.hibernate.query.results.ResultBuilderEntityValued;
|
||||||
import org.hibernate.query.results.complete.CompleteResultBuilderEntityStandard;
|
import org.hibernate.query.results.internal.complete.CompleteResultBuilderEntityStandard;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
|
@ -60,8 +60,8 @@ public class ResultMementoEntityStandard implements ResultMementoEntity, FetchMe
|
||||||
Consumer<String> querySpaceConsumer,
|
Consumer<String> querySpaceConsumer,
|
||||||
ResultSetMappingResolutionContext context) {
|
ResultSetMappingResolutionContext context) {
|
||||||
|
|
||||||
final BasicValuedFetchBuilder discriminatorResultBuilder = discriminatorMemento != null
|
final FetchBuilderBasicValued discriminatorResultBuilder = discriminatorMemento != null
|
||||||
? (BasicValuedFetchBuilder) discriminatorMemento.resolve( this, querySpaceConsumer, context )
|
? (FetchBuilderBasicValued) discriminatorMemento.resolve( this, querySpaceConsumer, context )
|
||||||
: null;
|
: null;
|
||||||
|
|
||||||
final HashMap<String, FetchBuilder> fetchBuilderMap = new HashMap<>();
|
final HashMap<String, FetchBuilder> fetchBuilderMap = new HashMap<>();
|
||||||
|
|
|
@ -11,7 +11,7 @@ import java.util.function.Consumer;
|
||||||
import org.hibernate.internal.util.collections.CollectionHelper;
|
import org.hibernate.internal.util.collections.CollectionHelper;
|
||||||
import org.hibernate.query.named.ResultMementoInstantiation;
|
import org.hibernate.query.named.ResultMementoInstantiation;
|
||||||
import org.hibernate.query.results.ResultBuilder;
|
import org.hibernate.query.results.ResultBuilder;
|
||||||
import org.hibernate.query.results.complete.CompleteResultBuilderInstantiation;
|
import org.hibernate.query.results.internal.complete.CompleteResultBuilderInstantiation;
|
||||||
import org.hibernate.type.descriptor.java.JavaType;
|
import org.hibernate.type.descriptor.java.JavaType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -4,32 +4,33 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.query.results;
|
package org.hibernate.query.results;
|
||||||
|
|
||||||
import java.util.function.BiConsumer;
|
|
||||||
import java.util.function.BiFunction;
|
|
||||||
|
|
||||||
import org.hibernate.Incubating;
|
import org.hibernate.Incubating;
|
||||||
import org.hibernate.spi.NavigablePath;
|
import org.hibernate.spi.NavigablePath;
|
||||||
import org.hibernate.query.results.dynamic.DynamicFetchBuilderLegacy;
|
|
||||||
import org.hibernate.sql.results.graph.DomainResult;
|
|
||||||
import org.hibernate.sql.results.graph.DomainResultCreationState;
|
import org.hibernate.sql.results.graph.DomainResultCreationState;
|
||||||
import org.hibernate.sql.results.graph.Fetch;
|
import org.hibernate.sql.results.graph.Fetch;
|
||||||
import org.hibernate.sql.results.graph.FetchParent;
|
import org.hibernate.sql.results.graph.FetchParent;
|
||||||
import org.hibernate.sql.results.jdbc.spi.JdbcValuesMetadata;
|
import org.hibernate.sql.results.jdbc.spi.JdbcValuesMetadata;
|
||||||
|
|
||||||
|
import java.util.function.BiConsumer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Responsible for building a single {@link DomainResult} instance as part of
|
* Responsible for building a single {@link Fetch} instance.
|
||||||
* the overall mapping of native / procedure query results.
|
* Given the following HQL for illustration,
|
||||||
|
* <pre>
|
||||||
|
* select b from Book b join fetch b.authors
|
||||||
|
* </pre>
|
||||||
|
* we have a single fetch : `Book(b).authors`
|
||||||
|
*
|
||||||
|
* @see ResultBuilder
|
||||||
*
|
*
|
||||||
* @apiNote By definition a fetch is a reference to the fetched ModelPart
|
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
*/
|
*/
|
||||||
@Incubating
|
@Incubating
|
||||||
public interface FetchBuilder {
|
public interface FetchBuilder extends GraphNodeBuilder {
|
||||||
Fetch buildFetch(
|
Fetch buildFetch(
|
||||||
FetchParent parent,
|
FetchParent parent,
|
||||||
NavigablePath fetchPath,
|
NavigablePath fetchPath,
|
||||||
JdbcValuesMetadata jdbcResultsMetadata,
|
JdbcValuesMetadata jdbcResultsMetadata,
|
||||||
BiFunction<String, String, DynamicFetchBuilderLegacy> legacyFetchResolver,
|
|
||||||
DomainResultCreationState domainResultCreationState);
|
DomainResultCreationState domainResultCreationState);
|
||||||
|
|
||||||
default void visitFetchBuilders(BiConsumer<String, FetchBuilder> consumer) {
|
default void visitFetchBuilders(BiConsumer<String, FetchBuilder> consumer) {
|
||||||
|
|
|
@ -4,24 +4,22 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.query.results;
|
package org.hibernate.query.results;
|
||||||
|
|
||||||
import java.util.function.BiFunction;
|
|
||||||
|
|
||||||
import org.hibernate.spi.NavigablePath;
|
import org.hibernate.spi.NavigablePath;
|
||||||
import org.hibernate.query.results.dynamic.DynamicFetchBuilderLegacy;
|
|
||||||
import org.hibernate.sql.results.graph.DomainResultCreationState;
|
import org.hibernate.sql.results.graph.DomainResultCreationState;
|
||||||
import org.hibernate.sql.results.graph.FetchParent;
|
import org.hibernate.sql.results.graph.FetchParent;
|
||||||
import org.hibernate.sql.results.graph.basic.BasicFetch;
|
import org.hibernate.sql.results.graph.basic.BasicFetch;
|
||||||
import org.hibernate.sql.results.jdbc.spi.JdbcValuesMetadata;
|
import org.hibernate.sql.results.jdbc.spi.JdbcValuesMetadata;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* FetchBuilder specialization for basic mappings
|
||||||
|
*
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
*/
|
*/
|
||||||
public interface BasicValuedFetchBuilder extends FetchBuilder {
|
public interface FetchBuilderBasicValued extends FetchBuilder {
|
||||||
@Override
|
@Override
|
||||||
BasicFetch<?> buildFetch(
|
BasicFetch<?> buildFetch(
|
||||||
FetchParent parent,
|
FetchParent parent,
|
||||||
NavigablePath fetchPath,
|
NavigablePath fetchPath,
|
||||||
JdbcValuesMetadata jdbcResultsMetadata,
|
JdbcValuesMetadata jdbcResultsMetadata,
|
||||||
BiFunction<String, String, DynamicFetchBuilderLegacy> legacyFetchResolver,
|
|
||||||
DomainResultCreationState domainResultCreationState);
|
DomainResultCreationState domainResultCreationState);
|
||||||
}
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
/*
|
||||||
|
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||||
|
* Copyright Red Hat Inc. and Hibernate Authors
|
||||||
|
*/
|
||||||
|
package org.hibernate.query.results;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Commonality between the builders for results and fetches.
|
||||||
|
*
|
||||||
|
* @see ResultBuilder
|
||||||
|
* @see FetchBuilder
|
||||||
|
*
|
||||||
|
* @author Steve Ebersole
|
||||||
|
*/
|
||||||
|
public interface GraphNodeBuilder {
|
||||||
|
}
|
|
@ -0,0 +1,33 @@
|
||||||
|
/*
|
||||||
|
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||||
|
* Copyright Red Hat Inc. and Hibernate Authors
|
||||||
|
*/
|
||||||
|
package org.hibernate.query.results;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Specialized FetchBuilder implementations which handle building fetches defined via:<ul>
|
||||||
|
* <li>{@code hbm.xml} definitions</li>
|
||||||
|
* <li>calls to {@link org.hibernate.query.NativeQuery#addFetch}, and friends</li>
|
||||||
|
* </ul>
|
||||||
|
*
|
||||||
|
* @author Steve Ebersole
|
||||||
|
*/
|
||||||
|
public interface LegacyFetchBuilder extends FetchBuilder {
|
||||||
|
/**
|
||||||
|
* The table-alias associated with the fetch modeled by this builder.
|
||||||
|
*/
|
||||||
|
String getTableAlias();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The alias for the node (result or fetch) which owns the fetch modeled by this builder.
|
||||||
|
*/
|
||||||
|
String getOwnerAlias();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The name of the model-part being fetched.
|
||||||
|
*/
|
||||||
|
String getFetchableName();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
LegacyFetchBuilder cacheKeyInstance();
|
||||||
|
}
|
|
@ -7,10 +7,8 @@ package org.hibernate.query.results;
|
||||||
import org.hibernate.HibernateException;
|
import org.hibernate.HibernateException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Indicates that a column defined as part of a SQL ResultSet mapping was not part
|
* Indicates that a column defined as part of a {@linkplain ResultSetMapping SQL ResultSet mapping} was not part
|
||||||
* of the query's ResultSet
|
* of the query's {@linkplain java.sql.ResultSet}
|
||||||
*
|
|
||||||
* @see ResultSetMapping
|
|
||||||
*
|
*
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,16 +0,0 @@
|
||||||
/*
|
|
||||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
|
||||||
* Copyright Red Hat Inc. and Hibernate Authors
|
|
||||||
*/
|
|
||||||
package org.hibernate.query.results;
|
|
||||||
|
|
||||||
import org.hibernate.HibernateException;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Steve Ebersole
|
|
||||||
*/
|
|
||||||
public class PositionalSelectionsNotAllowedException extends HibernateException {
|
|
||||||
public PositionalSelectionsNotAllowedException(String message) {
|
|
||||||
super( message );
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -4,29 +4,44 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.query.results;
|
package org.hibernate.query.results;
|
||||||
|
|
||||||
import java.util.function.BiConsumer;
|
|
||||||
import java.util.function.BiFunction;
|
|
||||||
|
|
||||||
import org.hibernate.Incubating;
|
import org.hibernate.Incubating;
|
||||||
import org.hibernate.query.results.dynamic.DynamicFetchBuilderLegacy;
|
|
||||||
import org.hibernate.sql.results.graph.DomainResult;
|
import org.hibernate.sql.results.graph.DomainResult;
|
||||||
import org.hibernate.sql.results.graph.DomainResultCreationState;
|
import org.hibernate.sql.results.graph.DomainResultCreationState;
|
||||||
import org.hibernate.sql.results.jdbc.spi.JdbcValuesMetadata;
|
import org.hibernate.sql.results.jdbc.spi.JdbcValuesMetadata;
|
||||||
|
|
||||||
|
import java.util.function.BiConsumer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Responsible for building a single {@link DomainResult} instance as part of
|
* Responsible for building a single {@link DomainResult}.
|
||||||
* the overall mapping of native / procedure query results.
|
* Given the following HQL for illustration,
|
||||||
|
* <pre>
|
||||||
|
* select b from Book b join fetch b.authors
|
||||||
|
* </pre>
|
||||||
|
* we have a single result : `Book(b)`
|
||||||
|
*
|
||||||
|
* @see FetchBuilder
|
||||||
*
|
*
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
*/
|
*/
|
||||||
@Incubating
|
@Incubating
|
||||||
public interface ResultBuilder {
|
public interface ResultBuilder extends GraphNodeBuilder {
|
||||||
|
/**
|
||||||
|
* Build a result
|
||||||
|
*
|
||||||
|
* @param jdbcResultsMetadata The JDBC values and metadata
|
||||||
|
* @param resultPosition The position in the domain results for the result to be built
|
||||||
|
* @param domainResultCreationState Access to useful stuff
|
||||||
|
*/
|
||||||
DomainResult<?> buildResult(
|
DomainResult<?> buildResult(
|
||||||
JdbcValuesMetadata jdbcResultsMetadata,
|
JdbcValuesMetadata jdbcResultsMetadata,
|
||||||
int resultPosition,
|
int resultPosition,
|
||||||
BiFunction<String, String, DynamicFetchBuilderLegacy> legacyFetchResolver,
|
|
||||||
DomainResultCreationState domainResultCreationState);
|
DomainResultCreationState domainResultCreationState);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Java type of the value returned for a {@linkplain DomainResult result} built by this builder.
|
||||||
|
*
|
||||||
|
* @see DomainResult#getResultJavaType()
|
||||||
|
*/
|
||||||
Class<?> getJavaType();
|
Class<?> getJavaType();
|
||||||
|
|
||||||
ResultBuilder cacheKeyInstance();
|
ResultBuilder cacheKeyInstance();
|
||||||
|
|
|
@ -4,15 +4,14 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.query.results;
|
package org.hibernate.query.results;
|
||||||
|
|
||||||
import java.util.function.BiFunction;
|
|
||||||
|
|
||||||
import org.hibernate.query.results.dynamic.DynamicFetchBuilderLegacy;
|
|
||||||
import org.hibernate.sql.results.graph.DomainResultCreationState;
|
import org.hibernate.sql.results.graph.DomainResultCreationState;
|
||||||
import org.hibernate.sql.results.graph.basic.BasicResult;
|
import org.hibernate.sql.results.graph.basic.BasicResult;
|
||||||
import org.hibernate.sql.results.jdbc.spi.JdbcValuesMetadata;
|
import org.hibernate.sql.results.jdbc.spi.JdbcValuesMetadata;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Nominal extension to ResultBuilder for cases involving scalar results
|
* ResultBuilder specialization for cases involving scalar results.
|
||||||
|
*
|
||||||
|
* @see jakarta.persistence.ColumnResult
|
||||||
*
|
*
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
*/
|
*/
|
||||||
|
@ -21,6 +20,5 @@ public interface ResultBuilderBasicValued extends ResultBuilder {
|
||||||
BasicResult<?> buildResult(
|
BasicResult<?> buildResult(
|
||||||
JdbcValuesMetadata jdbcResultsMetadata,
|
JdbcValuesMetadata jdbcResultsMetadata,
|
||||||
int resultPosition,
|
int resultPosition,
|
||||||
BiFunction<String, String, DynamicFetchBuilderLegacy> legacyFetchResolver,
|
|
||||||
DomainResultCreationState domainResultCreationState);
|
DomainResultCreationState domainResultCreationState);
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,21 +4,19 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.query.results;
|
package org.hibernate.query.results;
|
||||||
|
|
||||||
import java.util.function.BiFunction;
|
|
||||||
|
|
||||||
import org.hibernate.query.results.dynamic.DynamicFetchBuilderLegacy;
|
|
||||||
import org.hibernate.sql.results.graph.DomainResultCreationState;
|
import org.hibernate.sql.results.graph.DomainResultCreationState;
|
||||||
import org.hibernate.sql.results.graph.embeddable.EmbeddableResult;
|
import org.hibernate.sql.results.graph.embeddable.EmbeddableResult;
|
||||||
import org.hibernate.sql.results.jdbc.spi.JdbcValuesMetadata;
|
import org.hibernate.sql.results.jdbc.spi.JdbcValuesMetadata;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* ResultBuilder specialization for cases involving embeddable results.
|
||||||
|
*
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
*/
|
*/
|
||||||
public interface ResultBuilderEmbeddable extends ResultBuilder {
|
public interface ResultBuilderEmbeddable extends ResultBuilder {
|
||||||
@Override
|
@Override
|
||||||
EmbeddableResult buildResult(
|
EmbeddableResult<?> buildResult(
|
||||||
JdbcValuesMetadata jdbcResultsMetadata,
|
JdbcValuesMetadata jdbcResultsMetadata,
|
||||||
int resultPosition,
|
int resultPosition,
|
||||||
BiFunction<String, String, DynamicFetchBuilderLegacy> legacyFetchResolver,
|
|
||||||
DomainResultCreationState domainResultCreationState);
|
DomainResultCreationState domainResultCreationState);
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,15 +4,14 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.query.results;
|
package org.hibernate.query.results;
|
||||||
|
|
||||||
import java.util.function.BiFunction;
|
|
||||||
|
|
||||||
import org.hibernate.query.results.dynamic.DynamicFetchBuilderLegacy;
|
|
||||||
import org.hibernate.sql.results.graph.DomainResultCreationState;
|
import org.hibernate.sql.results.graph.DomainResultCreationState;
|
||||||
import org.hibernate.sql.results.graph.entity.EntityResult;
|
import org.hibernate.sql.results.graph.entity.EntityResult;
|
||||||
import org.hibernate.sql.results.jdbc.spi.JdbcValuesMetadata;
|
import org.hibernate.sql.results.jdbc.spi.JdbcValuesMetadata;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Specialization of ResultBuilder for building an EntityResult
|
* ResultBuilder specialization for cases involving entity results.
|
||||||
|
*
|
||||||
|
* @see jakarta.persistence.EntityResult
|
||||||
*
|
*
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
*/
|
*/
|
||||||
|
@ -21,6 +20,5 @@ public interface ResultBuilderEntityValued extends ResultBuilder {
|
||||||
EntityResult buildResult(
|
EntityResult buildResult(
|
||||||
JdbcValuesMetadata jdbcResultsMetadata,
|
JdbcValuesMetadata jdbcResultsMetadata,
|
||||||
int resultPosition,
|
int resultPosition,
|
||||||
BiFunction<String, String, DynamicFetchBuilderLegacy> legacyFetchResolver,
|
|
||||||
DomainResultCreationState domainResultCreationState);
|
DomainResultCreationState domainResultCreationState);
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,9 @@
|
||||||
package org.hibernate.query.results;
|
package org.hibernate.query.results;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Nominal extension to ResultBuilder for cases involving dynamic-instantiation results
|
* ResultBuilder specialization for cases involving dynamic-instantiation results.
|
||||||
|
*
|
||||||
|
* @see jakarta.persistence.ConstructorResult
|
||||||
*
|
*
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -4,26 +4,25 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.query.results;
|
package org.hibernate.query.results;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.function.BiConsumer;
|
|
||||||
import java.util.function.Consumer;
|
|
||||||
|
|
||||||
import org.hibernate.Incubating;
|
import org.hibernate.Incubating;
|
||||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
import org.hibernate.query.NativeQuery;
|
import org.hibernate.query.NativeQuery;
|
||||||
import org.hibernate.query.named.NamedResultSetMappingMemento;
|
import org.hibernate.query.named.NamedResultSetMappingMemento;
|
||||||
import org.hibernate.query.results.dynamic.DynamicFetchBuilderLegacy;
|
|
||||||
import org.hibernate.sql.results.jdbc.spi.JdbcValuesMappingProducer;
|
import org.hibernate.sql.results.jdbc.spi.JdbcValuesMappingProducer;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.function.BiConsumer;
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Acts as the {@link JdbcValuesMappingProducer} for {@link NativeQuery}
|
* JdbcValuesMappingProducer implementation based on a graph of {@linkplain ResultBuilder}
|
||||||
* or {@link org.hibernate.procedure.ProcedureCall} / {@link jakarta.persistence.StoredProcedureQuery}
|
* and {@linkplain FetchBuilder} reference. Used to model result-set mappings from:<ul>
|
||||||
* instances. These mappings can be defined<ul>
|
* <li>{@link jakarta.persistence.SqlResultSetMapping}</li>
|
||||||
|
* <li>{@code orm.xml}</li>
|
||||||
|
* <li>{@code mapping.xml}</li>
|
||||||
|
* <li>{@code hbm.xml}</li>
|
||||||
* <li>
|
* <li>
|
||||||
* statically via {@link jakarta.persistence.SqlResultSetMapping} or `hbm.xml` mapping
|
* Hibernate-specific APIs:<ul>
|
||||||
* </li>
|
|
||||||
* <li>
|
|
||||||
* dynamically via Hibernate-specific APIs:<ul>
|
|
||||||
* <li>{@link NativeQuery#addScalar}</li>
|
* <li>{@link NativeQuery#addScalar}</li>
|
||||||
* <li>{@link NativeQuery#addEntity}</li>
|
* <li>{@link NativeQuery#addEntity}</li>
|
||||||
* <li>{@link NativeQuery#addJoin}</li>
|
* <li>{@link NativeQuery#addJoin}</li>
|
||||||
|
@ -33,6 +32,10 @@ import org.hibernate.sql.results.jdbc.spi.JdbcValuesMappingProducer;
|
||||||
* </li>
|
* </li>
|
||||||
* </ul>
|
* </ul>
|
||||||
*
|
*
|
||||||
|
* @see NativeQuery
|
||||||
|
* @see org.hibernate.procedure.ProcedureCall
|
||||||
|
* @see jakarta.persistence.StoredProcedureQuery
|
||||||
|
*
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
*/
|
*/
|
||||||
@Incubating
|
@Incubating
|
||||||
|
@ -70,7 +73,7 @@ public interface ResultSetMapping extends JdbcValuesMappingProducer {
|
||||||
* {@link ResultBuilder#visitFetchBuilders}), fetches defined in the legacy way are unassociated
|
* {@link ResultBuilder#visitFetchBuilders}), fetches defined in the legacy way are unassociated
|
||||||
* to their "parent".
|
* to their "parent".
|
||||||
*/
|
*/
|
||||||
void visitLegacyFetchBuilders(Consumer<DynamicFetchBuilderLegacy> resultBuilderConsumer);
|
void visitLegacyFetchBuilders(Consumer<LegacyFetchBuilder> resultBuilderConsumer);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a builder
|
* Add a builder
|
||||||
|
@ -80,7 +83,7 @@ public interface ResultSetMapping extends JdbcValuesMappingProducer {
|
||||||
/**
|
/**
|
||||||
* Add a legacy fetch builder
|
* Add a legacy fetch builder
|
||||||
*/
|
*/
|
||||||
void addLegacyFetchBuilder(DynamicFetchBuilderLegacy fetchBuilder);
|
void addLegacyFetchBuilder(LegacyFetchBuilder fetchBuilder);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a memento from this mapping.
|
* Create a memento from this mapping.
|
||||||
|
|
|
@ -1,17 +0,0 @@
|
||||||
/*
|
|
||||||
* Hibernate, Relational Persistence for Idiomatic Java
|
|
||||||
*
|
|
||||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later
|
|
||||||
* See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Support for immutable result/fetch builder graph nodes built from static sources
|
|
||||||
* such as {@link jakarta.persistence.SqlResultSetMapping} or the {@code hbm.xml}
|
|
||||||
* mapping element {@code <resultset/>}.
|
|
||||||
* <p>
|
|
||||||
* The differentiation from {@link org.hibernate.query.results.dynamic} is that here
|
|
||||||
* we have up-front knowledge of the complete mapping graph and can perform optimized
|
|
||||||
* resolution process
|
|
||||||
*/
|
|
||||||
package org.hibernate.query.results.complete;
|
|
|
@ -1,21 +0,0 @@
|
||||||
/*
|
|
||||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
|
||||||
* Copyright Red Hat Inc. and Hibernate Authors
|
|
||||||
*/
|
|
||||||
package org.hibernate.query.results.dynamic;
|
|
||||||
|
|
||||||
import org.hibernate.query.NativeQuery;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Contract for handling Hibernate's legacy way of representing fetches through
|
|
||||||
* {@link NativeQuery#addFetch}, {@link NativeQuery#addJoin},
|
|
||||||
* `hbm.xml` mappings, etc
|
|
||||||
*
|
|
||||||
* @see org.hibernate.query.results.DomainResultCreationStateImpl#getLegacyFetchResolver()
|
|
||||||
*
|
|
||||||
* @author Steve Ebersole
|
|
||||||
*/
|
|
||||||
@FunctionalInterface
|
|
||||||
public interface LegacyFetchResolver {
|
|
||||||
DynamicFetchBuilderLegacy resolve(String ownerTableAlias, String fetchedPartPath);
|
|
||||||
}
|
|
|
@ -2,7 +2,7 @@
|
||||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||||
* Copyright Red Hat Inc. and Hibernate Authors
|
* Copyright Red Hat Inc. and Hibernate Authors
|
||||||
*/
|
*/
|
||||||
package org.hibernate.query.results;
|
package org.hibernate.query.results.internal;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
@ -23,23 +23,26 @@ import org.hibernate.metamodel.spi.MappingMetamodelImplementor;
|
||||||
import org.hibernate.persister.entity.EntityPersister;
|
import org.hibernate.persister.entity.EntityPersister;
|
||||||
import org.hibernate.query.NativeQuery;
|
import org.hibernate.query.NativeQuery;
|
||||||
import org.hibernate.query.internal.ResultSetMappingResolutionContext;
|
import org.hibernate.query.internal.ResultSetMappingResolutionContext;
|
||||||
import org.hibernate.query.results.dynamic.DynamicFetchBuilderLegacy;
|
import org.hibernate.query.results.FetchBuilder;
|
||||||
import org.hibernate.query.results.dynamic.DynamicResultBuilderAttribute;
|
import org.hibernate.query.results.ResultBuilder;
|
||||||
import org.hibernate.query.results.dynamic.DynamicResultBuilderBasic;
|
import org.hibernate.query.results.ResultBuilderBasicValued;
|
||||||
import org.hibernate.query.results.dynamic.DynamicResultBuilderBasicConverted;
|
import org.hibernate.query.results.internal.dynamic.DynamicFetchBuilderLegacy;
|
||||||
import org.hibernate.query.results.dynamic.DynamicResultBuilderBasicStandard;
|
import org.hibernate.query.results.internal.dynamic.DynamicResultBuilderAttribute;
|
||||||
import org.hibernate.query.results.dynamic.DynamicResultBuilderEntityCalculated;
|
import org.hibernate.query.results.internal.dynamic.DynamicResultBuilderBasic;
|
||||||
import org.hibernate.query.results.dynamic.DynamicResultBuilderEntityStandard;
|
import org.hibernate.query.results.internal.dynamic.DynamicResultBuilderBasicConverted;
|
||||||
import org.hibernate.query.results.dynamic.DynamicResultBuilderInstantiation;
|
import org.hibernate.query.results.internal.dynamic.DynamicResultBuilderBasicStandard;
|
||||||
import org.hibernate.query.results.implicit.ImplicitFetchBuilder;
|
import org.hibernate.query.results.internal.dynamic.DynamicResultBuilderEntityCalculated;
|
||||||
import org.hibernate.query.results.implicit.ImplicitFetchBuilderBasic;
|
import org.hibernate.query.results.internal.dynamic.DynamicResultBuilderEntityStandard;
|
||||||
import org.hibernate.query.results.implicit.ImplicitFetchBuilderDiscriminatedAssociation;
|
import org.hibernate.query.results.internal.dynamic.DynamicResultBuilderInstantiation;
|
||||||
import org.hibernate.query.results.implicit.ImplicitFetchBuilderEmbeddable;
|
import org.hibernate.query.results.internal.implicit.ImplicitFetchBuilder;
|
||||||
import org.hibernate.query.results.implicit.ImplicitFetchBuilderEntity;
|
import org.hibernate.query.results.internal.implicit.ImplicitFetchBuilderBasic;
|
||||||
import org.hibernate.query.results.implicit.ImplicitFetchBuilderEntityPart;
|
import org.hibernate.query.results.internal.implicit.ImplicitFetchBuilderDiscriminatedAssociation;
|
||||||
import org.hibernate.query.results.implicit.ImplicitFetchBuilderPlural;
|
import org.hibernate.query.results.internal.implicit.ImplicitFetchBuilderEmbeddable;
|
||||||
import org.hibernate.query.results.implicit.ImplicitModelPartResultBuilderEntity;
|
import org.hibernate.query.results.internal.implicit.ImplicitFetchBuilderEntity;
|
||||||
import org.hibernate.query.results.implicit.ImplicitResultClassBuilder;
|
import org.hibernate.query.results.internal.implicit.ImplicitFetchBuilderEntityPart;
|
||||||
|
import org.hibernate.query.results.internal.implicit.ImplicitFetchBuilderPlural;
|
||||||
|
import org.hibernate.query.results.internal.implicit.ImplicitModelPartResultBuilderEntity;
|
||||||
|
import org.hibernate.query.results.internal.implicit.ImplicitResultClassBuilder;
|
||||||
import org.hibernate.spi.NavigablePath;
|
import org.hibernate.spi.NavigablePath;
|
||||||
import org.hibernate.sql.results.graph.DomainResultCreationState;
|
import org.hibernate.sql.results.graph.DomainResultCreationState;
|
||||||
import org.hibernate.sql.results.graph.Fetchable;
|
import org.hibernate.sql.results.graph.Fetchable;
|
||||||
|
@ -52,6 +55,8 @@ import jakarta.persistence.metamodel.EntityType;
|
||||||
import jakarta.persistence.metamodel.SingularAttribute;
|
import jakarta.persistence.metamodel.SingularAttribute;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Commonly helpful creators for {@linkplain ResultBuilder} and {@linkplain FetchBuilder} references.
|
||||||
|
*
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
*/
|
*/
|
||||||
public class Builders {
|
public class Builders {
|
|
@ -2,13 +2,7 @@
|
||||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||||
* Copyright Red Hat Inc. and Hibernate Authors
|
* Copyright Red Hat Inc. and Hibernate Authors
|
||||||
*/
|
*/
|
||||||
package org.hibernate.query.results;
|
package org.hibernate.query.results.internal;
|
||||||
|
|
||||||
import java.util.AbstractMap;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.function.Consumer;
|
|
||||||
import java.util.function.Function;
|
|
||||||
|
|
||||||
import org.hibernate.Internal;
|
import org.hibernate.Internal;
|
||||||
import org.hibernate.LockMode;
|
import org.hibernate.LockMode;
|
||||||
|
@ -18,7 +12,6 @@ import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
import org.hibernate.internal.util.collections.Stack;
|
import org.hibernate.internal.util.collections.Stack;
|
||||||
import org.hibernate.internal.util.collections.StandardStack;
|
import org.hibernate.internal.util.collections.StandardStack;
|
||||||
import org.hibernate.metamodel.mapping.Association;
|
import org.hibernate.metamodel.mapping.Association;
|
||||||
import org.hibernate.metamodel.mapping.AssociationKey;
|
|
||||||
import org.hibernate.metamodel.mapping.AttributeMapping;
|
import org.hibernate.metamodel.mapping.AttributeMapping;
|
||||||
import org.hibernate.metamodel.mapping.CompositeIdentifierMapping;
|
import org.hibernate.metamodel.mapping.CompositeIdentifierMapping;
|
||||||
import org.hibernate.metamodel.mapping.EntityIdentifierMapping;
|
import org.hibernate.metamodel.mapping.EntityIdentifierMapping;
|
||||||
|
@ -28,11 +21,10 @@ import org.hibernate.metamodel.mapping.ModelPart;
|
||||||
import org.hibernate.metamodel.mapping.NonAggregatedIdentifierMapping;
|
import org.hibernate.metamodel.mapping.NonAggregatedIdentifierMapping;
|
||||||
import org.hibernate.metamodel.mapping.internal.BasicValuedCollectionPart;
|
import org.hibernate.metamodel.mapping.internal.BasicValuedCollectionPart;
|
||||||
import org.hibernate.metamodel.mapping.internal.CaseStatementDiscriminatorMappingImpl;
|
import org.hibernate.metamodel.mapping.internal.CaseStatementDiscriminatorMappingImpl;
|
||||||
import org.hibernate.metamodel.mapping.internal.SingleAttributeIdentifierMapping;
|
import org.hibernate.query.results.FetchBuilder;
|
||||||
|
import org.hibernate.query.results.LegacyFetchBuilder;
|
||||||
import org.hibernate.spi.EntityIdentifierNavigablePath;
|
import org.hibernate.spi.EntityIdentifierNavigablePath;
|
||||||
import org.hibernate.spi.NavigablePath;
|
import org.hibernate.spi.NavigablePath;
|
||||||
import org.hibernate.query.results.dynamic.DynamicFetchBuilderLegacy;
|
|
||||||
import org.hibernate.query.results.dynamic.LegacyFetchResolver;
|
|
||||||
import org.hibernate.sql.ast.spi.SqlAliasBaseGenerator;
|
import org.hibernate.sql.ast.spi.SqlAliasBaseGenerator;
|
||||||
import org.hibernate.sql.ast.spi.SqlAliasBaseManager;
|
import org.hibernate.sql.ast.spi.SqlAliasBaseManager;
|
||||||
import org.hibernate.sql.ast.spi.SqlAstCreationContext;
|
import org.hibernate.sql.ast.spi.SqlAstCreationContext;
|
||||||
|
@ -55,9 +47,20 @@ import org.hibernate.sql.results.jdbc.spi.JdbcValuesMetadata;
|
||||||
import org.hibernate.type.descriptor.java.JavaType;
|
import org.hibernate.type.descriptor.java.JavaType;
|
||||||
import org.hibernate.type.spi.TypeConfiguration;
|
import org.hibernate.type.spi.TypeConfiguration;
|
||||||
|
|
||||||
import static org.hibernate.query.results.ResultsHelper.attributeName;
|
import java.util.AbstractMap;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
import java.util.function.Function;
|
||||||
|
|
||||||
|
import static org.hibernate.query.results.internal.ResultsHelper.attributeName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Central implementation of {@linkplain DomainResultCreationState},
|
||||||
|
* {@linkplain SqlAstCreationState}, {@linkplain SqlAstProcessingState} and
|
||||||
|
* {@linkplain SqlExpressionResolver} used while building
|
||||||
|
* {@linkplain org.hibernate.query.results.ResultSetMapping} references.
|
||||||
|
*
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
*/
|
*/
|
||||||
@Internal
|
@Internal
|
||||||
|
@ -76,7 +79,7 @@ public class DomainResultCreationStateImpl
|
||||||
|
|
||||||
private final SqlAliasBaseManager sqlAliasBaseManager;
|
private final SqlAliasBaseManager sqlAliasBaseManager;
|
||||||
|
|
||||||
private final LegacyFetchResolverImpl legacyFetchResolver;
|
private final LegacyFetchResolver legacyFetchResolver;
|
||||||
private final SessionFactoryImplementor sessionFactory;
|
private final SessionFactoryImplementor sessionFactory;
|
||||||
|
|
||||||
private final Stack<Function> fetchBuilderResolverStack = new StandardStack<>( Function.class, fetchableName -> null );
|
private final Stack<Function> fetchBuilderResolverStack = new StandardStack<>( Function.class, fetchableName -> null );
|
||||||
|
@ -89,7 +92,7 @@ public class DomainResultCreationStateImpl
|
||||||
public DomainResultCreationStateImpl(
|
public DomainResultCreationStateImpl(
|
||||||
String stateIdentifier,
|
String stateIdentifier,
|
||||||
JdbcValuesMetadata jdbcResultsMetadata,
|
JdbcValuesMetadata jdbcResultsMetadata,
|
||||||
Map<String, Map<String, DynamicFetchBuilderLegacy>> legacyFetchBuilders,
|
Map<String, Map<String, LegacyFetchBuilder>> legacyFetchBuilders,
|
||||||
Consumer<SqlSelection> sqlSelectionConsumer,
|
Consumer<SqlSelection> sqlSelectionConsumer,
|
||||||
LoadQueryInfluencers loadQueryInfluencers,
|
LoadQueryInfluencers loadQueryInfluencers,
|
||||||
SessionFactoryImplementor sessionFactory) {
|
SessionFactoryImplementor sessionFactory) {
|
||||||
|
@ -100,15 +103,11 @@ public class DomainResultCreationStateImpl
|
||||||
this.fromClauseAccess = new FromClauseAccessImpl();
|
this.fromClauseAccess = new FromClauseAccessImpl();
|
||||||
this.sqlAliasBaseManager = new SqlAliasBaseManager();
|
this.sqlAliasBaseManager = new SqlAliasBaseManager();
|
||||||
|
|
||||||
this.legacyFetchResolver = new LegacyFetchResolverImpl( legacyFetchBuilders );
|
this.legacyFetchResolver = new LegacyFetchResolver( legacyFetchBuilders );
|
||||||
|
|
||||||
this.sessionFactory = sessionFactory;
|
this.sessionFactory = sessionFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
public LegacyFetchResolver getLegacyFetchResolver() {
|
|
||||||
return legacyFetchResolver;
|
|
||||||
}
|
|
||||||
|
|
||||||
public SessionFactoryImplementor getSessionFactory() {
|
public SessionFactoryImplementor getSessionFactory() {
|
||||||
return sessionFactory;
|
return sessionFactory;
|
||||||
}
|
}
|
||||||
|
@ -131,6 +130,7 @@ public class DomainResultCreationStateImpl
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map.Entry<String, NavigablePath> getCurrentRelativePath() {
|
public Map.Entry<String, NavigablePath> getCurrentRelativePath() {
|
||||||
|
//noinspection unchecked
|
||||||
return relativePathStack.getCurrent();
|
return relativePathStack.getCurrent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -139,10 +139,12 @@ public class DomainResultCreationStateImpl
|
||||||
}
|
}
|
||||||
|
|
||||||
public Function<String, FetchBuilder> getCurrentExplicitFetchMementoResolver() {
|
public Function<String, FetchBuilder> getCurrentExplicitFetchMementoResolver() {
|
||||||
|
//noinspection unchecked
|
||||||
return fetchBuilderResolverStack.getCurrent();
|
return fetchBuilderResolverStack.getCurrent();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Function<String, FetchBuilder> popExplicitFetchMementoResolver() {
|
public Function<String, FetchBuilder> popExplicitFetchMementoResolver() {
|
||||||
|
//noinspection unchecked
|
||||||
return fetchBuilderResolverStack.pop();
|
return fetchBuilderResolverStack.pop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -177,21 +179,6 @@ public class DomainResultCreationStateImpl
|
||||||
return sqlAliasBaseManager;
|
return sqlAliasBaseManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean forceIdentifierSelection() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean registerVisitedAssociationKey(AssociationKey associationKey) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isAssociationKeyVisited(AssociationKey associationKey) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ModelPart resolveModelPart(NavigablePath navigablePath) {
|
public ModelPart resolveModelPart(NavigablePath navigablePath) {
|
||||||
final TableGroup tableGroup = fromClauseAccess.findTableGroup( navigablePath );
|
final TableGroup tableGroup = fromClauseAccess.findTableGroup( navigablePath );
|
||||||
|
@ -283,8 +270,7 @@ public class DomainResultCreationStateImpl
|
||||||
sqlSelectionMap.put( key, (ResultSetMappingSqlSelection) created );
|
sqlSelectionMap.put( key, (ResultSetMappingSqlSelection) created );
|
||||||
sqlSelectionConsumer.accept( (ResultSetMappingSqlSelection) created );
|
sqlSelectionConsumer.accept( (ResultSetMappingSqlSelection) created );
|
||||||
}
|
}
|
||||||
else if ( created instanceof ColumnReference ) {
|
else if ( created instanceof ColumnReference columnReference ) {
|
||||||
final ColumnReference columnReference = (ColumnReference) created;
|
|
||||||
final String selectableName = columnReference.getSelectableName();
|
final String selectableName = columnReference.getSelectableName();
|
||||||
final int valuesArrayPosition;
|
final int valuesArrayPosition;
|
||||||
if ( nestingFetchParent != null ) {
|
if ( nestingFetchParent != null ) {
|
||||||
|
@ -341,20 +327,19 @@ public class DomainResultCreationStateImpl
|
||||||
return (SqlSelection) expression;
|
return (SqlSelection) expression;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class LegacyFetchResolverImpl implements LegacyFetchResolver {
|
private static class LegacyFetchResolver {
|
||||||
private final Map<String,Map<String, DynamicFetchBuilderLegacy>> legacyFetchBuilders;
|
private final Map<String,Map<String, LegacyFetchBuilder>> legacyFetchBuilders;
|
||||||
|
|
||||||
public LegacyFetchResolverImpl(Map<String, Map<String, DynamicFetchBuilderLegacy>> legacyFetchBuilders) {
|
public LegacyFetchResolver(Map<String, Map<String, LegacyFetchBuilder>> legacyFetchBuilders) {
|
||||||
this.legacyFetchBuilders = legacyFetchBuilders;
|
this.legacyFetchBuilders = legacyFetchBuilders;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public LegacyFetchBuilder resolve(String ownerTableAlias, String fetchedPartPath) {
|
||||||
public DynamicFetchBuilderLegacy resolve(String ownerTableAlias, String fetchedPartPath) {
|
|
||||||
if ( legacyFetchBuilders == null ) {
|
if ( legacyFetchBuilders == null ) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
final Map<String, DynamicFetchBuilderLegacy> fetchBuilders = legacyFetchBuilders.get( ownerTableAlias );
|
final Map<String, LegacyFetchBuilder> fetchBuilders = legacyFetchBuilders.get( ownerTableAlias );
|
||||||
if ( fetchBuilders == null ) {
|
if ( fetchBuilders == null ) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -377,6 +362,7 @@ public class DomainResultCreationStateImpl
|
||||||
final EntityValuedModelPart parentModelPart = fetchParent.getEntityValuedModelPart();
|
final EntityValuedModelPart parentModelPart = fetchParent.getEntityValuedModelPart();
|
||||||
final EntityIdentifierMapping identifierMapping = parentModelPart.getEntityMappingType().getIdentifierMapping();
|
final EntityIdentifierMapping identifierMapping = parentModelPart.getEntityMappingType().getIdentifierMapping();
|
||||||
final String identifierAttributeName = attributeName( identifierMapping );
|
final String identifierAttributeName = attributeName( identifierMapping );
|
||||||
|
//noinspection unchecked
|
||||||
final Map.Entry<String, NavigablePath> oldEntry = relativePathStack.getCurrent();
|
final Map.Entry<String, NavigablePath> oldEntry = relativePathStack.getCurrent();
|
||||||
final String fullPath;
|
final String fullPath;
|
||||||
if ( identifierMapping instanceof NonAggregatedIdentifierMapping ) {
|
if ( identifierMapping instanceof NonAggregatedIdentifierMapping ) {
|
||||||
|
@ -389,10 +375,9 @@ public class DomainResultCreationStateImpl
|
||||||
}
|
}
|
||||||
|
|
||||||
final Fetchable identifierFetchable = (Fetchable) identifierMapping;
|
final Fetchable identifierFetchable = (Fetchable) identifierMapping;
|
||||||
final FetchBuilder explicitFetchBuilder = (FetchBuilder) fetchBuilderResolverStack
|
//noinspection unchecked
|
||||||
.getCurrent()
|
final FetchBuilder explicitFetchBuilder = (FetchBuilder) fetchBuilderResolverStack.getCurrent().apply( fullPath );
|
||||||
.apply( fullPath );
|
LegacyFetchBuilder fetchBuilderLegacy;
|
||||||
DynamicFetchBuilderLegacy fetchBuilderLegacy;
|
|
||||||
if ( explicitFetchBuilder == null ) {
|
if ( explicitFetchBuilder == null ) {
|
||||||
fetchBuilderLegacy = legacyFetchResolver.resolve(
|
fetchBuilderLegacy = legacyFetchResolver.resolve(
|
||||||
fromClauseAccess.findTableGroup( fetchParent.getNavigablePath() )
|
fromClauseAccess.findTableGroup( fetchParent.getNavigablePath() )
|
||||||
|
@ -421,21 +406,17 @@ public class DomainResultCreationStateImpl
|
||||||
if ( explicitFetchBuilder != null ) {
|
if ( explicitFetchBuilder != null ) {
|
||||||
fetchBuilder = explicitFetchBuilder;
|
fetchBuilder = explicitFetchBuilder;
|
||||||
}
|
}
|
||||||
else {
|
else if ( fetchBuilderLegacy != null ) {
|
||||||
if ( fetchBuilderLegacy == null ) {
|
|
||||||
fetchBuilder = Builders.implicitFetchBuilder( fetchPath, identifierFetchable, this );
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
fetchBuilder = fetchBuilderLegacy;
|
fetchBuilder = fetchBuilderLegacy;
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
fetchBuilder = Builders.implicitFetchBuilder( fetchPath, identifierFetchable, this );
|
||||||
}
|
}
|
||||||
|
|
||||||
return fetchBuilder.buildFetch(
|
return fetchBuilder.buildFetch(
|
||||||
fetchParent,
|
fetchParent,
|
||||||
fetchPath,
|
fetchPath,
|
||||||
jdbcResultsMetadata,
|
jdbcResultsMetadata,
|
||||||
(s, s2) -> {
|
|
||||||
throw new UnsupportedOperationException();
|
|
||||||
},
|
|
||||||
this
|
this
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -471,6 +452,7 @@ public class DomainResultCreationStateImpl
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
//noinspection unchecked
|
||||||
final Map.Entry<String, NavigablePath> oldEntry = relativePathStack.getCurrent();
|
final Map.Entry<String, NavigablePath> oldEntry = relativePathStack.getCurrent();
|
||||||
final String key = oldEntry.getKey();
|
final String key = oldEntry.getKey();
|
||||||
currentEntry = new AbstractMap.SimpleEntry<>(
|
currentEntry = new AbstractMap.SimpleEntry<>(
|
||||||
|
@ -480,10 +462,9 @@ public class DomainResultCreationStateImpl
|
||||||
}
|
}
|
||||||
// todo (6.0): figure out if we can somehow create the navigable paths in a better way
|
// todo (6.0): figure out if we can somehow create the navigable paths in a better way
|
||||||
final String fullPath = currentEntry.getKey();
|
final String fullPath = currentEntry.getKey();
|
||||||
FetchBuilder explicitFetchBuilder = (FetchBuilder) fetchBuilderResolverStack
|
//noinspection unchecked
|
||||||
.getCurrent()
|
FetchBuilder explicitFetchBuilder = (FetchBuilder) fetchBuilderResolverStack.getCurrent().apply( fullPath );
|
||||||
.apply( fullPath );
|
LegacyFetchBuilder fetchBuilderLegacy;
|
||||||
DynamicFetchBuilderLegacy fetchBuilderLegacy;
|
|
||||||
if ( explicitFetchBuilder == null ) {
|
if ( explicitFetchBuilder == null ) {
|
||||||
fetchBuilderLegacy = legacyFetchResolver.resolve(
|
fetchBuilderLegacy = legacyFetchResolver.resolve(
|
||||||
fromClauseAccess.findTableGroup( fetchParent.getNavigablePath() )
|
fromClauseAccess.findTableGroup( fetchParent.getNavigablePath() )
|
||||||
|
@ -495,8 +476,7 @@ public class DomainResultCreationStateImpl
|
||||||
else {
|
else {
|
||||||
fetchBuilderLegacy = null;
|
fetchBuilderLegacy = null;
|
||||||
}
|
}
|
||||||
if ( fetchable instanceof Association && fetchable.getMappedFetchOptions().getTiming() == FetchTiming.DELAYED ) {
|
if ( fetchable instanceof Association association && fetchable.getMappedFetchOptions().getTiming() == FetchTiming.DELAYED ) {
|
||||||
final Association association = (Association) fetchable;
|
|
||||||
final ForeignKeyDescriptor foreignKeyDescriptor = association.getForeignKeyDescriptor();
|
final ForeignKeyDescriptor foreignKeyDescriptor = association.getForeignKeyDescriptor();
|
||||||
|
|
||||||
final String partName = attributeName(
|
final String partName = attributeName(
|
||||||
|
@ -509,9 +489,8 @@ public class DomainResultCreationStateImpl
|
||||||
currentEntry.getKey() + "." + partName,
|
currentEntry.getKey() + "." + partName,
|
||||||
currentEntry.getValue().append( partName )
|
currentEntry.getValue().append( partName )
|
||||||
);
|
);
|
||||||
explicitFetchBuilder = (FetchBuilder) fetchBuilderResolverStack
|
//noinspection unchecked
|
||||||
.getCurrent()
|
explicitFetchBuilder = (FetchBuilder) fetchBuilderResolverStack.getCurrent().apply( currentEntry.getKey() );
|
||||||
.apply( currentEntry.getKey() );
|
|
||||||
if ( explicitFetchBuilder == null ) {
|
if ( explicitFetchBuilder == null ) {
|
||||||
fetchBuilderLegacy = legacyFetchResolver.resolve(
|
fetchBuilderLegacy = legacyFetchResolver.resolve(
|
||||||
fromClauseAccess.findTableGroup( fetchParent.getNavigablePath() )
|
fromClauseAccess.findTableGroup( fetchParent.getNavigablePath() )
|
||||||
|
@ -524,27 +503,21 @@ public class DomainResultCreationStateImpl
|
||||||
}
|
}
|
||||||
relativePathStack.push( currentEntry );
|
relativePathStack.push( currentEntry );
|
||||||
try {
|
try {
|
||||||
|
|
||||||
final NavigablePath fetchPath = fetchParent.resolveNavigablePath( fetchable );
|
final NavigablePath fetchPath = fetchParent.resolveNavigablePath( fetchable );
|
||||||
final FetchBuilder fetchBuilder;
|
final FetchBuilder fetchBuilder;
|
||||||
if ( explicitFetchBuilder != null ) {
|
if ( explicitFetchBuilder != null ) {
|
||||||
fetchBuilder = explicitFetchBuilder;
|
fetchBuilder = explicitFetchBuilder;
|
||||||
}
|
}
|
||||||
else {
|
else if ( fetchBuilderLegacy == null ) {
|
||||||
if ( fetchBuilderLegacy == null ) {
|
|
||||||
fetchBuilder = Builders.implicitFetchBuilder( fetchPath, fetchable, this );
|
fetchBuilder = Builders.implicitFetchBuilder( fetchPath, fetchable, this );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
fetchBuilder = fetchBuilderLegacy;
|
fetchBuilder = fetchBuilderLegacy;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
final Fetch fetch = fetchBuilder.buildFetch(
|
final Fetch fetch = fetchBuilder.buildFetch(
|
||||||
fetchParent,
|
fetchParent,
|
||||||
fetchPath,
|
fetchPath,
|
||||||
jdbcResultsMetadata,
|
jdbcResultsMetadata,
|
||||||
(s, s2) -> {
|
|
||||||
throw new UnsupportedOperationException();
|
|
||||||
},
|
|
||||||
this
|
this
|
||||||
);
|
);
|
||||||
fetches.add( fetch );
|
fetches.add( fetch );
|
||||||
|
@ -557,8 +530,8 @@ public class DomainResultCreationStateImpl
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getRelativePath(String oldEntry, Fetchable fetchable) {
|
private String getRelativePath(String oldEntry, Fetchable fetchable) {
|
||||||
if ( fetchable instanceof AttributeMapping || fetchable instanceof SingleAttributeIdentifierMapping || fetchable instanceof BasicValuedCollectionPart ) {
|
if ( fetchable instanceof AttributeMapping || fetchable instanceof BasicValuedCollectionPart ) {
|
||||||
if ( !oldEntry.equals( "" ) ) {
|
if ( !"".equals( oldEntry ) ) {
|
||||||
return oldEntry + '.' + fetchable.getFetchableName();
|
return oldEntry + '.' + fetchable.getFetchableName();
|
||||||
}
|
}
|
||||||
return fetchable.getFetchableName();
|
return fetchable.getFetchableName();
|
|
@ -2,7 +2,7 @@
|
||||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||||
* Copyright Red Hat Inc. and Hibernate Authors
|
* Copyright Red Hat Inc. and Hibernate Authors
|
||||||
*/
|
*/
|
||||||
package org.hibernate.query.results;
|
package org.hibernate.query.results.internal;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -14,6 +14,9 @@ import org.hibernate.sql.ast.tree.from.TableGroup;
|
||||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* FromClauseAccess implementation used while building
|
||||||
|
* {@linkplain org.hibernate.query.results.ResultSetMapping} references.
|
||||||
|
*
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
*/
|
*/
|
||||||
public class FromClauseAccessImpl implements FromClauseAccess {
|
public class FromClauseAccessImpl implements FromClauseAccess {
|
||||||
|
@ -57,8 +60,7 @@ public class FromClauseAccessImpl implements FromClauseAccess {
|
||||||
@Override
|
@Override
|
||||||
public TableGroup findTableGroup(NavigablePath navigablePath) {
|
public TableGroup findTableGroup(NavigablePath navigablePath) {
|
||||||
if ( tableGroupByPath != null ) {
|
if ( tableGroupByPath != null ) {
|
||||||
final TableGroup tableGroup = tableGroupByPath.get( navigablePath );
|
return tableGroupByPath.get( navigablePath );
|
||||||
return tableGroup;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
|
@ -2,27 +2,24 @@
|
||||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||||
* Copyright Red Hat Inc. and Hibernate Authors
|
* Copyright Red Hat Inc. and Hibernate Authors
|
||||||
*/
|
*/
|
||||||
package org.hibernate.query.results;
|
package org.hibernate.query.results.internal;
|
||||||
|
|
||||||
import java.util.List;
|
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.hibernate.Internal;
|
|
||||||
import org.hibernate.LockMode;
|
import org.hibernate.LockMode;
|
||||||
import org.hibernate.sql.ast.spi.SqlSelection;
|
import org.hibernate.sql.ast.spi.SqlSelection;
|
||||||
import org.hibernate.sql.results.graph.DomainResult;
|
import org.hibernate.sql.results.graph.DomainResult;
|
||||||
import org.hibernate.sql.results.jdbc.internal.StandardJdbcValuesMapping;
|
import org.hibernate.sql.results.jdbc.internal.StandardJdbcValuesMapping;
|
||||||
|
|
||||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implementation of JdbcValuesMapping for native / procedure queries
|
* JdbcValuesMapping implementation used while building
|
||||||
|
* {@linkplain org.hibernate.query.results.ResultSetMapping} references.
|
||||||
*
|
*
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
*/
|
*/
|
||||||
@Internal
|
|
||||||
public class JdbcValuesMappingImpl extends StandardJdbcValuesMapping {
|
public class JdbcValuesMappingImpl extends StandardJdbcValuesMapping {
|
||||||
|
|
||||||
private final int rowSize;
|
private final int rowSize;
|
||||||
private final @Nullable Map<String, LockMode> registeredLockModes;
|
private final @Nullable Map<String, LockMode> registeredLockModes;
|
||||||
|
|
|
@ -2,7 +2,26 @@
|
||||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||||
* Copyright Red Hat Inc. and Hibernate Authors
|
* Copyright Red Hat Inc. and Hibernate Authors
|
||||||
*/
|
*/
|
||||||
package org.hibernate.query.results;
|
package org.hibernate.query.results.internal;
|
||||||
|
|
||||||
|
import org.hibernate.engine.spi.LoadQueryInfluencers;
|
||||||
|
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
|
import org.hibernate.internal.util.StringHelper;
|
||||||
|
import org.hibernate.loader.NonUniqueDiscoveredSqlAliasException;
|
||||||
|
import org.hibernate.metamodel.mapping.BasicValuedMapping;
|
||||||
|
import org.hibernate.persister.entity.EntityPersister;
|
||||||
|
import org.hibernate.query.named.NamedResultSetMappingMemento;
|
||||||
|
import org.hibernate.query.results.LegacyFetchBuilder;
|
||||||
|
import org.hibernate.query.results.ResultBuilder;
|
||||||
|
import org.hibernate.query.results.ResultSetMapping;
|
||||||
|
import org.hibernate.sql.ast.spi.SqlSelection;
|
||||||
|
import org.hibernate.sql.results.graph.DomainResult;
|
||||||
|
import org.hibernate.sql.results.graph.basic.BasicResult;
|
||||||
|
import org.hibernate.sql.results.graph.entity.EntityResult;
|
||||||
|
import org.hibernate.sql.results.jdbc.spi.JdbcValuesMapping;
|
||||||
|
import org.hibernate.sql.results.jdbc.spi.JdbcValuesMappingProducer;
|
||||||
|
import org.hibernate.sql.results.jdbc.spi.JdbcValuesMetadata;
|
||||||
|
import org.hibernate.type.BasicType;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
@ -15,35 +34,17 @@ import java.util.TreeSet;
|
||||||
import java.util.function.BiConsumer;
|
import java.util.function.BiConsumer;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
import org.hibernate.Incubating;
|
|
||||||
import org.hibernate.Internal;
|
|
||||||
import org.hibernate.engine.spi.LoadQueryInfluencers;
|
|
||||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
|
||||||
import org.hibernate.internal.util.StringHelper;
|
|
||||||
import org.hibernate.loader.NonUniqueDiscoveredSqlAliasException;
|
|
||||||
import org.hibernate.metamodel.mapping.BasicValuedMapping;
|
|
||||||
import org.hibernate.persister.entity.EntityPersister;
|
|
||||||
import org.hibernate.query.named.NamedResultSetMappingMemento;
|
|
||||||
import org.hibernate.query.results.dynamic.DynamicFetchBuilderLegacy;
|
|
||||||
import org.hibernate.sql.ast.spi.SqlSelection;
|
|
||||||
import org.hibernate.sql.results.graph.DomainResult;
|
|
||||||
import org.hibernate.sql.results.graph.basic.BasicResult;
|
|
||||||
import org.hibernate.sql.results.graph.entity.EntityResult;
|
|
||||||
import org.hibernate.sql.results.jdbc.spi.JdbcValuesMapping;
|
|
||||||
import org.hibernate.sql.results.jdbc.spi.JdbcValuesMappingProducer;
|
|
||||||
import org.hibernate.sql.results.jdbc.spi.JdbcValuesMetadata;
|
|
||||||
import org.hibernate.type.BasicType;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* ResultSetMapping implementation used while building
|
||||||
|
* {@linkplain org.hibernate.query.results.ResultSetMapping} references.
|
||||||
|
*
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
*/
|
*/
|
||||||
@Incubating
|
|
||||||
@Internal
|
|
||||||
public class ResultSetMappingImpl implements ResultSetMapping {
|
public class ResultSetMappingImpl implements ResultSetMapping {
|
||||||
private final String mappingIdentifier;
|
private final String mappingIdentifier;
|
||||||
private final boolean isDynamic;
|
private final boolean isDynamic;
|
||||||
private List<ResultBuilder> resultBuilders;
|
private List<ResultBuilder> resultBuilders;
|
||||||
private Map<String, Map<String, DynamicFetchBuilderLegacy>> legacyFetchBuilders;
|
private Map<String, Map<String, LegacyFetchBuilder>> legacyFetchBuilders;
|
||||||
|
|
||||||
public ResultSetMappingImpl(String mappingIdentifier) {
|
public ResultSetMappingImpl(String mappingIdentifier) {
|
||||||
this( mappingIdentifier, false );
|
this( mappingIdentifier, false );
|
||||||
|
@ -71,10 +72,10 @@ public class ResultSetMappingImpl implements ResultSetMapping {
|
||||||
this.legacyFetchBuilders = null;
|
this.legacyFetchBuilders = null;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
final Map<String, Map<String, DynamicFetchBuilderLegacy>> legacyFetchBuilders = new HashMap<>( original.legacyFetchBuilders.size() );
|
final Map<String, Map<String, LegacyFetchBuilder>> legacyFetchBuilders = new HashMap<>( original.legacyFetchBuilders.size() );
|
||||||
for ( Map.Entry<String, Map<String, DynamicFetchBuilderLegacy>> entry : original.legacyFetchBuilders.entrySet() ) {
|
for ( Map.Entry<String, Map<String, LegacyFetchBuilder>> entry : original.legacyFetchBuilders.entrySet() ) {
|
||||||
final Map<String, DynamicFetchBuilderLegacy> newValue = new HashMap<>( entry.getValue().size() );
|
final Map<String, LegacyFetchBuilder> newValue = new HashMap<>( entry.getValue().size() );
|
||||||
for ( Map.Entry<String, DynamicFetchBuilderLegacy> builderEntry : entry.getValue().entrySet() ) {
|
for ( Map.Entry<String, LegacyFetchBuilder> builderEntry : entry.getValue().entrySet() ) {
|
||||||
newValue.put( builderEntry.getKey(), builderEntry.getValue().cacheKeyInstance() );
|
newValue.put( builderEntry.getKey(), builderEntry.getValue().cacheKeyInstance() );
|
||||||
}
|
}
|
||||||
legacyFetchBuilders.put( entry.getKey(), newValue );
|
legacyFetchBuilders.put( entry.getKey(), newValue );
|
||||||
|
@ -117,13 +118,13 @@ public class ResultSetMappingImpl implements ResultSetMapping {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void visitLegacyFetchBuilders(Consumer<DynamicFetchBuilderLegacy> resultBuilderConsumer) {
|
public void visitLegacyFetchBuilders(Consumer<LegacyFetchBuilder> resultBuilderConsumer) {
|
||||||
if ( legacyFetchBuilders == null ) {
|
if ( legacyFetchBuilders == null ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for ( Map.Entry<String, Map<String, DynamicFetchBuilderLegacy>> entry : legacyFetchBuilders.entrySet() ) {
|
for ( Map.Entry<String, Map<String, LegacyFetchBuilder>> entry : legacyFetchBuilders.entrySet() ) {
|
||||||
for ( DynamicFetchBuilderLegacy fetchBuilder : entry.getValue().values() ) {
|
for ( LegacyFetchBuilder fetchBuilder : entry.getValue().values() ) {
|
||||||
resultBuilderConsumer.accept( fetchBuilder );
|
resultBuilderConsumer.accept( fetchBuilder );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -138,8 +139,8 @@ public class ResultSetMappingImpl implements ResultSetMapping {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addLegacyFetchBuilder(DynamicFetchBuilderLegacy fetchBuilder) {
|
public void addLegacyFetchBuilder(LegacyFetchBuilder fetchBuilder) {
|
||||||
final Map<String, DynamicFetchBuilderLegacy> existingFetchBuildersByOwner;
|
final Map<String, LegacyFetchBuilder> existingFetchBuildersByOwner;
|
||||||
|
|
||||||
if ( legacyFetchBuilders == null ) {
|
if ( legacyFetchBuilders == null ) {
|
||||||
legacyFetchBuilders = new HashMap<>();
|
legacyFetchBuilders = new HashMap<>();
|
||||||
|
@ -149,7 +150,7 @@ public class ResultSetMappingImpl implements ResultSetMapping {
|
||||||
existingFetchBuildersByOwner = legacyFetchBuilders.get( fetchBuilder.getOwnerAlias() );
|
existingFetchBuildersByOwner = legacyFetchBuilders.get( fetchBuilder.getOwnerAlias() );
|
||||||
}
|
}
|
||||||
|
|
||||||
final Map<String, DynamicFetchBuilderLegacy> fetchBuildersByOwner;
|
final Map<String, LegacyFetchBuilder> fetchBuildersByOwner;
|
||||||
if ( existingFetchBuildersByOwner == null ) {
|
if ( existingFetchBuildersByOwner == null ) {
|
||||||
fetchBuildersByOwner = new HashMap<>();
|
fetchBuildersByOwner = new HashMap<>();
|
||||||
legacyFetchBuilders.put( fetchBuilder.getOwnerAlias(), fetchBuildersByOwner );
|
legacyFetchBuilders.put( fetchBuilder.getOwnerAlias(), fetchBuildersByOwner );
|
||||||
|
@ -158,10 +159,7 @@ public class ResultSetMappingImpl implements ResultSetMapping {
|
||||||
fetchBuildersByOwner = existingFetchBuildersByOwner;
|
fetchBuildersByOwner = existingFetchBuildersByOwner;
|
||||||
}
|
}
|
||||||
|
|
||||||
final DynamicFetchBuilderLegacy previousBuilder = fetchBuildersByOwner.put( fetchBuilder.getFetchableName(), fetchBuilder );
|
fetchBuildersByOwner.put( fetchBuilder.getFetchableName(), fetchBuilder );
|
||||||
if ( previousBuilder != null ) {
|
|
||||||
// todo (6.0) : error? log? nothing?
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -226,7 +224,6 @@ public class ResultSetMappingImpl implements ResultSetMapping {
|
||||||
domainResult = resultBuilder.buildResult(
|
domainResult = resultBuilder.buildResult(
|
||||||
jdbcResultsMetadata,
|
jdbcResultsMetadata,
|
||||||
domainResults.size(),
|
domainResults.size(),
|
||||||
creationState.getLegacyFetchResolver()::resolve,
|
|
||||||
creationState
|
creationState
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -317,7 +314,7 @@ public class ResultSetMappingImpl implements ResultSetMapping {
|
||||||
final ResultSetMappingSqlSelection sqlSelection = new ResultSetMappingSqlSelection( valuesArrayPosition, (BasicValuedMapping) jdbcMapping );
|
final ResultSetMappingSqlSelection sqlSelection = new ResultSetMappingSqlSelection( valuesArrayPosition, (BasicValuedMapping) jdbcMapping );
|
||||||
sqlSelectionConsumer.accept( sqlSelection );
|
sqlSelectionConsumer.accept( sqlSelection );
|
||||||
|
|
||||||
return new BasicResult(
|
return new BasicResult<>(
|
||||||
valuesArrayPosition,
|
valuesArrayPosition,
|
||||||
name,
|
name,
|
||||||
jdbcMapping,
|
jdbcMapping,
|
|
@ -2,7 +2,7 @@
|
||||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||||
* Copyright Red Hat Inc. and Hibernate Authors
|
* Copyright Red Hat Inc. and Hibernate Authors
|
||||||
*/
|
*/
|
||||||
package org.hibernate.query.results;
|
package org.hibernate.query.results.internal;
|
||||||
|
|
||||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
import org.hibernate.metamodel.mapping.BasicValuedMapping;
|
import org.hibernate.metamodel.mapping.BasicValuedMapping;
|
||||||
|
@ -16,15 +16,16 @@ import org.hibernate.sql.results.jdbc.spi.JdbcValuesMetadata;
|
||||||
import org.hibernate.type.descriptor.ValueExtractor;
|
import org.hibernate.type.descriptor.ValueExtractor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SqlSelection used in {@link ResultSetMapping} resolution. Doubles as its own
|
* SqlSelection implementation used while building
|
||||||
* {@link Expression} as well.
|
* {@linkplain org.hibernate.query.results.ResultSetMapping} references.
|
||||||
|
* Doubles as its own {@link Expression} as well.
|
||||||
*
|
*
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
*/
|
*/
|
||||||
public class ResultSetMappingSqlSelection implements SqlSelection, Expression, SqlExpressionAccess {
|
public class ResultSetMappingSqlSelection implements SqlSelection, Expression, SqlExpressionAccess {
|
||||||
private final int valuesArrayPosition;
|
private final int valuesArrayPosition;
|
||||||
private final BasicValuedMapping valueMapping;
|
private final BasicValuedMapping valueMapping;
|
||||||
private final ValueExtractor valueExtractor;
|
private final ValueExtractor<?> valueExtractor;
|
||||||
|
|
||||||
public ResultSetMappingSqlSelection(int valuesArrayPosition, BasicValuedMapping valueMapping) {
|
public ResultSetMappingSqlSelection(int valuesArrayPosition, BasicValuedMapping valueMapping) {
|
||||||
this.valuesArrayPosition = valuesArrayPosition;
|
this.valuesArrayPosition = valuesArrayPosition;
|
||||||
|
@ -39,7 +40,7 @@ public class ResultSetMappingSqlSelection implements SqlSelection, Expression, S
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ValueExtractor getJdbcValueExtractor() {
|
public ValueExtractor<?> getJdbcValueExtractor() {
|
||||||
return valueExtractor;
|
return valueExtractor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,7 +60,7 @@ public class ResultSetMappingSqlSelection implements SqlSelection, Expression, S
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MappingModelExpressible getExpressionType() {
|
public MappingModelExpressible<?> getExpressionType() {
|
||||||
return valueMapping;
|
return valueMapping;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||||
* Copyright Red Hat Inc. and Hibernate Authors
|
* Copyright Red Hat Inc. and Hibernate Authors
|
||||||
*/
|
*/
|
||||||
package org.hibernate.query.results;
|
package org.hibernate.query.results.internal;
|
||||||
|
|
||||||
import org.hibernate.metamodel.mapping.EntityIdentifierMapping;
|
import org.hibernate.metamodel.mapping.EntityIdentifierMapping;
|
||||||
import org.hibernate.metamodel.mapping.ModelPart;
|
import org.hibernate.metamodel.mapping.ModelPart;
|
||||||
|
@ -42,7 +42,7 @@ public class ResultsHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new IllegalArgumentException(
|
throw new IllegalArgumentException(
|
||||||
"Passed DomainResultCreationState not an instance of org.hibernate.query.results.DomainResultCreationStateImpl"
|
"Passed DomainResultCreationState not an instance of org.hibernate.query.results.internal.DomainResultCreationStateImpl"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||||
* Copyright Red Hat Inc. and Hibernate Authors
|
* Copyright Red Hat Inc. and Hibernate Authors
|
||||||
*/
|
*/
|
||||||
package org.hibernate.query.results;
|
package org.hibernate.query.results.internal;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -15,7 +15,8 @@ import org.hibernate.sql.ast.tree.from.TableReference;
|
||||||
import org.hibernate.sql.ast.tree.from.TableReferenceJoin;
|
import org.hibernate.sql.ast.tree.from.TableReferenceJoin;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A TableGroup created with regards to a SQL ResultSet mapping
|
* TableGroup implementation used while building
|
||||||
|
* {@linkplain org.hibernate.query.results.ResultSetMapping} references.
|
||||||
*
|
*
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
*/
|
*/
|
|
@ -2,7 +2,7 @@
|
||||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||||
* Copyright Red Hat Inc. and Hibernate Authors
|
* Copyright Red Hat Inc. and Hibernate Authors
|
||||||
*/
|
*/
|
||||||
package org.hibernate.query.results.complete;
|
package org.hibernate.query.results.internal.complete;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
|
@ -2,25 +2,19 @@
|
||||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||||
* Copyright Red Hat Inc. and Hibernate Authors
|
* Copyright Red Hat Inc. and Hibernate Authors
|
||||||
*/
|
*/
|
||||||
package org.hibernate.query.results.complete;
|
package org.hibernate.query.results.internal.complete;
|
||||||
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.function.BiFunction;
|
|
||||||
|
|
||||||
|
import org.hibernate.AssertionFailure;
|
||||||
import org.hibernate.engine.FetchTiming;
|
import org.hibernate.engine.FetchTiming;
|
||||||
import org.hibernate.metamodel.mapping.BasicValuedModelPart;
|
import org.hibernate.metamodel.mapping.BasicValuedModelPart;
|
||||||
import org.hibernate.metamodel.mapping.DiscriminatorMapping;
|
import org.hibernate.metamodel.mapping.DiscriminatorMapping;
|
||||||
import org.hibernate.metamodel.mapping.JdbcMapping;
|
import org.hibernate.metamodel.mapping.JdbcMapping;
|
||||||
import org.hibernate.spi.NavigablePath;
|
|
||||||
import org.hibernate.query.results.BasicValuedFetchBuilder;
|
|
||||||
import org.hibernate.query.results.DomainResultCreationStateImpl;
|
|
||||||
import org.hibernate.query.results.FetchBuilder;
|
import org.hibernate.query.results.FetchBuilder;
|
||||||
|
import org.hibernate.query.results.FetchBuilderBasicValued;
|
||||||
import org.hibernate.query.results.MissingSqlSelectionException;
|
import org.hibernate.query.results.MissingSqlSelectionException;
|
||||||
import org.hibernate.query.results.PositionalSelectionsNotAllowedException;
|
import org.hibernate.query.results.internal.DomainResultCreationStateImpl;
|
||||||
import org.hibernate.query.results.ResultSetMappingSqlSelection;
|
import org.hibernate.query.results.internal.ResultSetMappingSqlSelection;
|
||||||
import org.hibernate.query.results.dynamic.DynamicFetchBuilderLegacy;
|
import org.hibernate.spi.NavigablePath;
|
||||||
import org.hibernate.sql.ast.tree.from.TableGroup;
|
import org.hibernate.sql.ast.tree.from.TableGroup;
|
||||||
import org.hibernate.sql.ast.tree.from.TableReference;
|
import org.hibernate.sql.ast.tree.from.TableReference;
|
||||||
import org.hibernate.sql.results.graph.DomainResultCreationState;
|
import org.hibernate.sql.results.graph.DomainResultCreationState;
|
||||||
|
@ -28,14 +22,18 @@ import org.hibernate.sql.results.graph.FetchParent;
|
||||||
import org.hibernate.sql.results.graph.basic.BasicFetch;
|
import org.hibernate.sql.results.graph.basic.BasicFetch;
|
||||||
import org.hibernate.sql.results.jdbc.spi.JdbcValuesMetadata;
|
import org.hibernate.sql.results.jdbc.spi.JdbcValuesMetadata;
|
||||||
|
|
||||||
import static org.hibernate.query.results.ResultsHelper.impl;
|
import java.util.Collections;
|
||||||
import static org.hibernate.query.results.ResultsHelper.jdbcPositionToValuesArrayPosition;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import static org.hibernate.query.results.internal.ResultsHelper.impl;
|
||||||
|
import static org.hibernate.query.results.internal.ResultsHelper.jdbcPositionToValuesArrayPosition;
|
||||||
import static org.hibernate.sql.ast.spi.SqlExpressionResolver.createColumnReferenceKey;
|
import static org.hibernate.sql.ast.spi.SqlExpressionResolver.createColumnReferenceKey;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
*/
|
*/
|
||||||
public class CompleteFetchBuilderBasicPart implements CompleteFetchBuilder, BasicValuedFetchBuilder, ModelPartReferenceBasic {
|
public class CompleteFetchBuilderBasicPart implements CompleteFetchBuilder, FetchBuilderBasicValued, ModelPartReferenceBasic {
|
||||||
private final NavigablePath navigablePath;
|
private final NavigablePath navigablePath;
|
||||||
private final BasicValuedModelPart referencedModelPart;
|
private final BasicValuedModelPart referencedModelPart;
|
||||||
private final String selectionAlias;
|
private final String selectionAlias;
|
||||||
|
@ -74,7 +72,6 @@ public class CompleteFetchBuilderBasicPart implements CompleteFetchBuilder, Basi
|
||||||
FetchParent parent,
|
FetchParent parent,
|
||||||
NavigablePath fetchPath,
|
NavigablePath fetchPath,
|
||||||
JdbcValuesMetadata jdbcResultsMetadata,
|
JdbcValuesMetadata jdbcResultsMetadata,
|
||||||
BiFunction<String, String, DynamicFetchBuilderLegacy> legacyFetchResolver,
|
|
||||||
DomainResultCreationState domainResultCreationState) {
|
DomainResultCreationState domainResultCreationState) {
|
||||||
final DomainResultCreationStateImpl creationStateImpl = impl( domainResultCreationState );
|
final DomainResultCreationStateImpl creationStateImpl = impl( domainResultCreationState );
|
||||||
|
|
||||||
|
@ -101,9 +98,7 @@ public class CompleteFetchBuilderBasicPart implements CompleteFetchBuilder, Basi
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if ( ! creationStateImpl.arePositionalSelectionsAllowed() ) {
|
if ( ! creationStateImpl.arePositionalSelectionsAllowed() ) {
|
||||||
throw new PositionalSelectionsNotAllowedException(
|
throw new AssertionFailure( "Positional SQL selection resolution not allowed" );
|
||||||
"Positional SQL selection resolution not allowed"
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
jdbcPosition = creationStateImpl.getNumberOfProcessedSelections() + 1;
|
jdbcPosition = creationStateImpl.getNumberOfProcessedSelections() + 1;
|
||||||
selectedAlias = jdbcResultsMetadata.resolveColumnName( jdbcPosition );
|
selectedAlias = jdbcResultsMetadata.resolveColumnName( jdbcPosition );
|
|
@ -2,17 +2,15 @@
|
||||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||||
* Copyright Red Hat Inc. and Hibernate Authors
|
* Copyright Red Hat Inc. and Hibernate Authors
|
||||||
*/
|
*/
|
||||||
package org.hibernate.query.results.complete;
|
package org.hibernate.query.results.internal.complete;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.function.BiFunction;
|
|
||||||
|
|
||||||
import org.hibernate.engine.FetchTiming;
|
import org.hibernate.engine.FetchTiming;
|
||||||
import org.hibernate.metamodel.mapping.EmbeddableValuedModelPart;
|
import org.hibernate.metamodel.mapping.EmbeddableValuedModelPart;
|
||||||
import org.hibernate.query.results.DomainResultCreationStateImpl;
|
import org.hibernate.query.results.internal.DomainResultCreationStateImpl;
|
||||||
import org.hibernate.query.results.FetchBuilder;
|
import org.hibernate.query.results.FetchBuilder;
|
||||||
import org.hibernate.query.results.ResultsHelper;
|
import org.hibernate.query.results.internal.ResultsHelper;
|
||||||
import org.hibernate.query.results.dynamic.DynamicFetchBuilderLegacy;
|
|
||||||
import org.hibernate.spi.NavigablePath;
|
import org.hibernate.spi.NavigablePath;
|
||||||
import org.hibernate.sql.ast.tree.from.TableGroup;
|
import org.hibernate.sql.ast.tree.from.TableGroup;
|
||||||
import org.hibernate.sql.ast.tree.from.TableReference;
|
import org.hibernate.sql.ast.tree.from.TableReference;
|
||||||
|
@ -21,7 +19,7 @@ import org.hibernate.sql.results.graph.Fetch;
|
||||||
import org.hibernate.sql.results.graph.FetchParent;
|
import org.hibernate.sql.results.graph.FetchParent;
|
||||||
import org.hibernate.sql.results.jdbc.spi.JdbcValuesMetadata;
|
import org.hibernate.sql.results.jdbc.spi.JdbcValuesMetadata;
|
||||||
|
|
||||||
import static org.hibernate.query.results.ResultsHelper.impl;
|
import static org.hibernate.query.results.internal.ResultsHelper.impl;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CompleteFetchBuilder for embeddable-valued ModelParts
|
* CompleteFetchBuilder for embeddable-valued ModelParts
|
||||||
|
@ -72,7 +70,6 @@ public class CompleteFetchBuilderEmbeddableValuedModelPart
|
||||||
FetchParent parent,
|
FetchParent parent,
|
||||||
NavigablePath fetchPath,
|
NavigablePath fetchPath,
|
||||||
JdbcValuesMetadata jdbcResultsMetadata,
|
JdbcValuesMetadata jdbcResultsMetadata,
|
||||||
BiFunction<String, String, DynamicFetchBuilderLegacy> legacyFetchResolver,
|
|
||||||
DomainResultCreationState domainResultCreationState) {
|
DomainResultCreationState domainResultCreationState) {
|
||||||
assert fetchPath.equals( navigablePath );
|
assert fetchPath.equals( navigablePath );
|
||||||
final DomainResultCreationStateImpl creationStateImpl = impl( domainResultCreationState );
|
final DomainResultCreationStateImpl creationStateImpl = impl( domainResultCreationState );
|
|
@ -2,18 +2,16 @@
|
||||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||||
* Copyright Red Hat Inc. and Hibernate Authors
|
* Copyright Red Hat Inc. and Hibernate Authors
|
||||||
*/
|
*/
|
||||||
package org.hibernate.query.results.complete;
|
package org.hibernate.query.results.internal.complete;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.function.BiFunction;
|
|
||||||
|
|
||||||
import org.hibernate.engine.FetchTiming;
|
import org.hibernate.engine.FetchTiming;
|
||||||
import org.hibernate.metamodel.mapping.ValuedModelPart;
|
import org.hibernate.metamodel.mapping.ValuedModelPart;
|
||||||
import org.hibernate.query.results.ResultsHelper;
|
import org.hibernate.query.results.internal.ResultsHelper;
|
||||||
import org.hibernate.spi.NavigablePath;
|
import org.hibernate.spi.NavigablePath;
|
||||||
import org.hibernate.query.results.DomainResultCreationStateImpl;
|
import org.hibernate.query.results.internal.DomainResultCreationStateImpl;
|
||||||
import org.hibernate.query.results.FetchBuilder;
|
import org.hibernate.query.results.FetchBuilder;
|
||||||
import org.hibernate.query.results.dynamic.DynamicFetchBuilderLegacy;
|
|
||||||
import org.hibernate.sql.ast.tree.from.TableGroup;
|
import org.hibernate.sql.ast.tree.from.TableGroup;
|
||||||
import org.hibernate.sql.ast.tree.from.TableReference;
|
import org.hibernate.sql.ast.tree.from.TableReference;
|
||||||
import org.hibernate.sql.results.graph.DomainResultCreationState;
|
import org.hibernate.sql.results.graph.DomainResultCreationState;
|
||||||
|
@ -22,7 +20,7 @@ import org.hibernate.sql.results.graph.FetchParent;
|
||||||
import org.hibernate.sql.results.graph.entity.EntityValuedFetchable;
|
import org.hibernate.sql.results.graph.entity.EntityValuedFetchable;
|
||||||
import org.hibernate.sql.results.jdbc.spi.JdbcValuesMetadata;
|
import org.hibernate.sql.results.jdbc.spi.JdbcValuesMetadata;
|
||||||
|
|
||||||
import static org.hibernate.query.results.ResultsHelper.impl;
|
import static org.hibernate.query.results.internal.ResultsHelper.impl;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CompleteFetchBuilder for entity-valued ModelParts
|
* CompleteFetchBuilder for entity-valued ModelParts
|
||||||
|
@ -73,7 +71,6 @@ public class CompleteFetchBuilderEntityValuedModelPart
|
||||||
FetchParent parent,
|
FetchParent parent,
|
||||||
NavigablePath fetchPath,
|
NavigablePath fetchPath,
|
||||||
JdbcValuesMetadata jdbcResultsMetadata,
|
JdbcValuesMetadata jdbcResultsMetadata,
|
||||||
BiFunction<String, String, DynamicFetchBuilderLegacy> legacyFetchResolver,
|
|
||||||
DomainResultCreationState domainResultCreationState) {
|
DomainResultCreationState domainResultCreationState) {
|
||||||
assert fetchPath.equals( navigablePath );
|
assert fetchPath.equals( navigablePath );
|
||||||
final DomainResultCreationStateImpl creationStateImpl = impl( domainResultCreationState );
|
final DomainResultCreationStateImpl creationStateImpl = impl( domainResultCreationState );
|
|
@ -2,7 +2,7 @@
|
||||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||||
* Copyright Red Hat Inc. and Hibernate Authors
|
* Copyright Red Hat Inc. and Hibernate Authors
|
||||||
*/
|
*/
|
||||||
package org.hibernate.query.results.complete;
|
package org.hibernate.query.results.internal.complete;
|
||||||
|
|
||||||
import org.hibernate.query.results.ResultBuilder;
|
import org.hibernate.query.results.ResultBuilder;
|
||||||
|
|
|
@ -2,16 +2,13 @@
|
||||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||||
* Copyright Red Hat Inc. and Hibernate Authors
|
* Copyright Red Hat Inc. and Hibernate Authors
|
||||||
*/
|
*/
|
||||||
package org.hibernate.query.results.complete;
|
package org.hibernate.query.results.internal.complete;
|
||||||
|
|
||||||
import java.util.function.BiFunction;
|
|
||||||
|
|
||||||
import org.hibernate.metamodel.mapping.BasicValuedModelPart;
|
import org.hibernate.metamodel.mapping.BasicValuedModelPart;
|
||||||
import org.hibernate.query.results.ResultsHelper;
|
|
||||||
import org.hibernate.spi.NavigablePath;
|
|
||||||
import org.hibernate.query.results.DomainResultCreationStateImpl;
|
|
||||||
import org.hibernate.query.results.ResultBuilder;
|
import org.hibernate.query.results.ResultBuilder;
|
||||||
import org.hibernate.query.results.dynamic.DynamicFetchBuilderLegacy;
|
import org.hibernate.query.results.internal.DomainResultCreationStateImpl;
|
||||||
|
import org.hibernate.query.results.internal.ResultsHelper;
|
||||||
|
import org.hibernate.spi.NavigablePath;
|
||||||
import org.hibernate.sql.ast.spi.SqlSelection;
|
import org.hibernate.sql.ast.spi.SqlSelection;
|
||||||
import org.hibernate.sql.ast.tree.from.TableGroup;
|
import org.hibernate.sql.ast.tree.from.TableGroup;
|
||||||
import org.hibernate.sql.ast.tree.from.TableReference;
|
import org.hibernate.sql.ast.tree.from.TableReference;
|
||||||
|
@ -19,7 +16,7 @@ import org.hibernate.sql.results.graph.DomainResultCreationState;
|
||||||
import org.hibernate.sql.results.graph.basic.BasicResult;
|
import org.hibernate.sql.results.graph.basic.BasicResult;
|
||||||
import org.hibernate.sql.results.jdbc.spi.JdbcValuesMetadata;
|
import org.hibernate.sql.results.jdbc.spi.JdbcValuesMetadata;
|
||||||
|
|
||||||
import static org.hibernate.query.results.ResultsHelper.impl;
|
import static org.hibernate.query.results.internal.ResultsHelper.impl;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CompleteResultBuilder for basic-valued ModelParts
|
* CompleteResultBuilder for basic-valued ModelParts
|
||||||
|
@ -65,7 +62,6 @@ public class CompleteResultBuilderBasicModelPart
|
||||||
public BasicResult<?> buildResult(
|
public BasicResult<?> buildResult(
|
||||||
JdbcValuesMetadata jdbcResultsMetadata,
|
JdbcValuesMetadata jdbcResultsMetadata,
|
||||||
int resultPosition,
|
int resultPosition,
|
||||||
BiFunction<String, String, DynamicFetchBuilderLegacy> legacyFetchResolver,
|
|
||||||
DomainResultCreationState domainResultCreationState) {
|
DomainResultCreationState domainResultCreationState) {
|
||||||
final DomainResultCreationStateImpl creationStateImpl = impl( domainResultCreationState );
|
final DomainResultCreationStateImpl creationStateImpl = impl( domainResultCreationState );
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||||
* Copyright Red Hat Inc. and Hibernate Authors
|
* Copyright Red Hat Inc. and Hibernate Authors
|
||||||
*/
|
*/
|
||||||
package org.hibernate.query.results.complete;
|
package org.hibernate.query.results.internal.complete;
|
||||||
|
|
||||||
import org.hibernate.query.results.ResultBuilderBasicValued;
|
import org.hibernate.query.results.ResultBuilderBasicValued;
|
||||||
|
|
|
@ -2,31 +2,28 @@
|
||||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||||
* Copyright Red Hat Inc. and Hibernate Authors
|
* Copyright Red Hat Inc. and Hibernate Authors
|
||||||
*/
|
*/
|
||||||
package org.hibernate.query.results.complete;
|
package org.hibernate.query.results.internal.complete;
|
||||||
|
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.function.BiFunction;
|
|
||||||
|
|
||||||
|
import jakarta.persistence.AttributeConverter;
|
||||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
import org.hibernate.metamodel.mapping.BasicValuedMapping;
|
import org.hibernate.metamodel.mapping.BasicValuedMapping;
|
||||||
import org.hibernate.type.descriptor.converter.internal.JpaAttributeConverterImpl;
|
|
||||||
import org.hibernate.query.results.DomainResultCreationStateImpl;
|
|
||||||
import org.hibernate.query.results.ResultBuilder;
|
import org.hibernate.query.results.ResultBuilder;
|
||||||
import org.hibernate.query.results.ResultsHelper;
|
import org.hibernate.query.results.internal.DomainResultCreationStateImpl;
|
||||||
import org.hibernate.query.results.ResultSetMappingSqlSelection;
|
import org.hibernate.query.results.internal.ResultSetMappingSqlSelection;
|
||||||
import org.hibernate.query.results.dynamic.DynamicFetchBuilderLegacy;
|
import org.hibernate.query.results.internal.ResultsHelper;
|
||||||
import org.hibernate.resource.beans.spi.ManagedBean;
|
import org.hibernate.resource.beans.spi.ManagedBean;
|
||||||
import org.hibernate.sql.ast.spi.SqlExpressionResolver;
|
import org.hibernate.sql.ast.spi.SqlExpressionResolver;
|
||||||
import org.hibernate.sql.ast.spi.SqlSelection;
|
import org.hibernate.sql.ast.spi.SqlSelection;
|
||||||
import org.hibernate.sql.results.graph.DomainResultCreationState;
|
import org.hibernate.sql.results.graph.DomainResultCreationState;
|
||||||
import org.hibernate.sql.results.graph.basic.BasicResult;
|
import org.hibernate.sql.results.graph.basic.BasicResult;
|
||||||
import org.hibernate.sql.results.jdbc.spi.JdbcValuesMetadata;
|
import org.hibernate.sql.results.jdbc.spi.JdbcValuesMetadata;
|
||||||
|
import org.hibernate.type.descriptor.converter.internal.JpaAttributeConverterImpl;
|
||||||
import org.hibernate.type.descriptor.java.BasicJavaType;
|
import org.hibernate.type.descriptor.java.BasicJavaType;
|
||||||
import org.hibernate.type.descriptor.java.JavaType;
|
import org.hibernate.type.descriptor.java.JavaType;
|
||||||
|
|
||||||
import jakarta.persistence.AttributeConverter;
|
import java.util.Objects;
|
||||||
|
|
||||||
import static org.hibernate.query.results.ResultsHelper.impl;
|
import static org.hibernate.query.results.internal.ResultsHelper.impl;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ResultBuilder for scalar results defined via:<ul>
|
* ResultBuilder for scalar results defined via:<ul>
|
||||||
|
@ -49,6 +46,7 @@ public class CompleteResultBuilderBasicValuedConverted<O,R> implements CompleteR
|
||||||
BasicValuedMapping underlyingMapping) {
|
BasicValuedMapping underlyingMapping) {
|
||||||
this.explicitColumnName = explicitColumnName;
|
this.explicitColumnName = explicitColumnName;
|
||||||
this.underlyingMapping = underlyingMapping;
|
this.underlyingMapping = underlyingMapping;
|
||||||
|
//noinspection unchecked,rawtypes
|
||||||
this.valueConverter = new JpaAttributeConverterImpl<>(
|
this.valueConverter = new JpaAttributeConverterImpl<>(
|
||||||
converterBean,
|
converterBean,
|
||||||
converterJtd,
|
converterJtd,
|
||||||
|
@ -71,7 +69,6 @@ public class CompleteResultBuilderBasicValuedConverted<O,R> implements CompleteR
|
||||||
public BasicResult<?> buildResult(
|
public BasicResult<?> buildResult(
|
||||||
JdbcValuesMetadata jdbcResultsMetadata,
|
JdbcValuesMetadata jdbcResultsMetadata,
|
||||||
int resultPosition,
|
int resultPosition,
|
||||||
BiFunction<String, String, DynamicFetchBuilderLegacy> legacyFetchResolver,
|
|
||||||
DomainResultCreationState domainResultCreationState) {
|
DomainResultCreationState domainResultCreationState) {
|
||||||
final DomainResultCreationStateImpl creationStateImpl = impl( domainResultCreationState );
|
final DomainResultCreationStateImpl creationStateImpl = impl( domainResultCreationState );
|
||||||
final SessionFactoryImplementor sessionFactory = creationStateImpl.getSessionFactory();
|
final SessionFactoryImplementor sessionFactory = creationStateImpl.getSessionFactory();
|
|
@ -2,19 +2,15 @@
|
||||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||||
* Copyright Red Hat Inc. and Hibernate Authors
|
* Copyright Red Hat Inc. and Hibernate Authors
|
||||||
*/
|
*/
|
||||||
package org.hibernate.query.results.complete;
|
package org.hibernate.query.results.internal.complete;
|
||||||
|
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.function.BiFunction;
|
|
||||||
|
|
||||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
import org.hibernate.metamodel.mapping.BasicValuedMapping;
|
import org.hibernate.metamodel.mapping.BasicValuedMapping;
|
||||||
import org.hibernate.metamodel.mapping.JdbcMapping;
|
import org.hibernate.metamodel.mapping.JdbcMapping;
|
||||||
import org.hibernate.query.results.DomainResultCreationStateImpl;
|
|
||||||
import org.hibernate.query.results.ResultBuilder;
|
import org.hibernate.query.results.ResultBuilder;
|
||||||
import org.hibernate.query.results.ResultsHelper;
|
import org.hibernate.query.results.internal.DomainResultCreationStateImpl;
|
||||||
import org.hibernate.query.results.ResultSetMappingSqlSelection;
|
import org.hibernate.query.results.internal.ResultSetMappingSqlSelection;
|
||||||
import org.hibernate.query.results.dynamic.DynamicFetchBuilderLegacy;
|
import org.hibernate.query.results.internal.ResultsHelper;
|
||||||
import org.hibernate.sql.ast.spi.SqlExpressionResolver;
|
import org.hibernate.sql.ast.spi.SqlExpressionResolver;
|
||||||
import org.hibernate.sql.ast.spi.SqlSelection;
|
import org.hibernate.sql.ast.spi.SqlSelection;
|
||||||
import org.hibernate.sql.results.graph.DomainResultCreationState;
|
import org.hibernate.sql.results.graph.DomainResultCreationState;
|
||||||
|
@ -22,7 +18,9 @@ import org.hibernate.sql.results.graph.basic.BasicResult;
|
||||||
import org.hibernate.sql.results.jdbc.spi.JdbcValuesMetadata;
|
import org.hibernate.sql.results.jdbc.spi.JdbcValuesMetadata;
|
||||||
import org.hibernate.type.descriptor.java.JavaType;
|
import org.hibernate.type.descriptor.java.JavaType;
|
||||||
|
|
||||||
import static org.hibernate.query.results.ResultsHelper.impl;
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import static org.hibernate.query.results.internal.ResultsHelper.impl;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ResultBuilder for scalar results defined via:<ul>
|
* ResultBuilder for scalar results defined via:<ul>
|
||||||
|
@ -43,6 +41,7 @@ public class CompleteResultBuilderBasicValuedStandard implements CompleteResultB
|
||||||
String explicitColumnName,
|
String explicitColumnName,
|
||||||
BasicValuedMapping explicitType,
|
BasicValuedMapping explicitType,
|
||||||
JavaType<?> explicitJavaType) {
|
JavaType<?> explicitJavaType) {
|
||||||
|
//noinspection unchecked
|
||||||
assert explicitType == null || explicitType.getJdbcMapping()
|
assert explicitType == null || explicitType.getJdbcMapping()
|
||||||
.getJavaTypeDescriptor()
|
.getJavaTypeDescriptor()
|
||||||
.getJavaTypeClass()
|
.getJavaTypeClass()
|
||||||
|
@ -67,7 +66,6 @@ public class CompleteResultBuilderBasicValuedStandard implements CompleteResultB
|
||||||
public BasicResult<?> buildResult(
|
public BasicResult<?> buildResult(
|
||||||
JdbcValuesMetadata jdbcResultsMetadata,
|
JdbcValuesMetadata jdbcResultsMetadata,
|
||||||
int resultPosition,
|
int resultPosition,
|
||||||
BiFunction<String, String, DynamicFetchBuilderLegacy> legacyFetchResolver,
|
|
||||||
DomainResultCreationState domainResultCreationState) {
|
DomainResultCreationState domainResultCreationState) {
|
||||||
final DomainResultCreationStateImpl creationStateImpl = impl( domainResultCreationState );
|
final DomainResultCreationStateImpl creationStateImpl = impl( domainResultCreationState );
|
||||||
final SessionFactoryImplementor sessionFactory = creationStateImpl.getSessionFactory();
|
final SessionFactoryImplementor sessionFactory = creationStateImpl.getSessionFactory();
|
|
@ -2,7 +2,7 @@
|
||||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||||
* Copyright Red Hat Inc. and Hibernate Authors
|
* Copyright Red Hat Inc. and Hibernate Authors
|
||||||
*/
|
*/
|
||||||
package org.hibernate.query.results.complete;
|
package org.hibernate.query.results.internal.complete;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
|
@ -2,10 +2,7 @@
|
||||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||||
* Copyright Red Hat Inc. and Hibernate Authors
|
* Copyright Red Hat Inc. and Hibernate Authors
|
||||||
*/
|
*/
|
||||||
package org.hibernate.query.results.complete;
|
package org.hibernate.query.results.internal.complete;
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.function.BiFunction;
|
|
||||||
|
|
||||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
import org.hibernate.metamodel.mapping.EntityMappingType;
|
import org.hibernate.metamodel.mapping.EntityMappingType;
|
||||||
|
@ -14,11 +11,10 @@ import org.hibernate.metamodel.mapping.ModelPart;
|
||||||
import org.hibernate.metamodel.mapping.PluralAttributeMapping;
|
import org.hibernate.metamodel.mapping.PluralAttributeMapping;
|
||||||
import org.hibernate.metamodel.mapping.SelectableConsumer;
|
import org.hibernate.metamodel.mapping.SelectableConsumer;
|
||||||
import org.hibernate.query.NativeQuery;
|
import org.hibernate.query.NativeQuery;
|
||||||
import org.hibernate.query.results.DomainResultCreationStateImpl;
|
|
||||||
import org.hibernate.query.results.FromClauseAccessImpl;
|
|
||||||
import org.hibernate.query.results.ResultBuilder;
|
import org.hibernate.query.results.ResultBuilder;
|
||||||
import org.hibernate.query.results.ResultsHelper;
|
import org.hibernate.query.results.internal.DomainResultCreationStateImpl;
|
||||||
import org.hibernate.query.results.dynamic.DynamicFetchBuilderLegacy;
|
import org.hibernate.query.results.internal.FromClauseAccessImpl;
|
||||||
|
import org.hibernate.query.results.internal.ResultsHelper;
|
||||||
import org.hibernate.spi.NavigablePath;
|
import org.hibernate.spi.NavigablePath;
|
||||||
import org.hibernate.sql.ast.spi.SqlAliasBaseConstant;
|
import org.hibernate.sql.ast.spi.SqlAliasBaseConstant;
|
||||||
import org.hibernate.sql.ast.tree.from.TableGroup;
|
import org.hibernate.sql.ast.tree.from.TableGroup;
|
||||||
|
@ -26,7 +22,9 @@ import org.hibernate.sql.results.graph.DomainResult;
|
||||||
import org.hibernate.sql.results.graph.DomainResultCreationState;
|
import org.hibernate.sql.results.graph.DomainResultCreationState;
|
||||||
import org.hibernate.sql.results.jdbc.spi.JdbcValuesMetadata;
|
import org.hibernate.sql.results.jdbc.spi.JdbcValuesMetadata;
|
||||||
|
|
||||||
import static org.hibernate.query.results.ResultsHelper.impl;
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
import static org.hibernate.query.results.internal.ResultsHelper.impl;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
|
@ -91,7 +89,6 @@ public class CompleteResultBuilderCollectionStandard implements CompleteResultBu
|
||||||
public DomainResult<?> buildResult(
|
public DomainResult<?> buildResult(
|
||||||
JdbcValuesMetadata jdbcResultsMetadata,
|
JdbcValuesMetadata jdbcResultsMetadata,
|
||||||
int resultPosition,
|
int resultPosition,
|
||||||
BiFunction<String, String, DynamicFetchBuilderLegacy> legacyFetchResolver,
|
|
||||||
DomainResultCreationState domainResultCreationState) {
|
DomainResultCreationState domainResultCreationState) {
|
||||||
final DomainResultCreationStateImpl creationStateImpl = impl( domainResultCreationState );
|
final DomainResultCreationStateImpl creationStateImpl = impl( domainResultCreationState );
|
||||||
final SessionFactoryImplementor sessionFactory = creationStateImpl.getSessionFactory();
|
final SessionFactoryImplementor sessionFactory = creationStateImpl.getSessionFactory();
|
|
@ -2,28 +2,26 @@
|
||||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||||
* Copyright Red Hat Inc. and Hibernate Authors
|
* Copyright Red Hat Inc. and Hibernate Authors
|
||||||
*/
|
*/
|
||||||
package org.hibernate.query.results.complete;
|
package org.hibernate.query.results.internal.complete;
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.function.BiConsumer;
|
|
||||||
import java.util.function.BiFunction;
|
|
||||||
|
|
||||||
import org.hibernate.LockMode;
|
import org.hibernate.LockMode;
|
||||||
import org.hibernate.metamodel.mapping.EntityDiscriminatorMapping;
|
import org.hibernate.metamodel.mapping.EntityDiscriminatorMapping;
|
||||||
import org.hibernate.metamodel.mapping.EntityMappingType;
|
import org.hibernate.metamodel.mapping.EntityMappingType;
|
||||||
import org.hibernate.query.results.BasicValuedFetchBuilder;
|
|
||||||
import org.hibernate.query.results.DomainResultCreationStateImpl;
|
|
||||||
import org.hibernate.query.results.FetchBuilder;
|
import org.hibernate.query.results.FetchBuilder;
|
||||||
|
import org.hibernate.query.results.FetchBuilderBasicValued;
|
||||||
import org.hibernate.query.results.ResultBuilder;
|
import org.hibernate.query.results.ResultBuilder;
|
||||||
import org.hibernate.query.results.ResultsHelper;
|
import org.hibernate.query.results.internal.DomainResultCreationStateImpl;
|
||||||
import org.hibernate.query.results.dynamic.DynamicFetchBuilderLegacy;
|
import org.hibernate.query.results.internal.ResultsHelper;
|
||||||
import org.hibernate.spi.NavigablePath;
|
import org.hibernate.spi.NavigablePath;
|
||||||
import org.hibernate.sql.ast.spi.SqlAliasBase;
|
import org.hibernate.sql.ast.spi.SqlAliasBase;
|
||||||
import org.hibernate.sql.results.graph.DomainResultCreationState;
|
import org.hibernate.sql.results.graph.DomainResultCreationState;
|
||||||
import org.hibernate.sql.results.graph.entity.EntityResult;
|
import org.hibernate.sql.results.graph.entity.EntityResult;
|
||||||
import org.hibernate.sql.results.jdbc.spi.JdbcValuesMetadata;
|
import org.hibernate.sql.results.jdbc.spi.JdbcValuesMetadata;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.function.BiConsumer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CompleteResultBuilderEntityValued implementation specific to JPA. In JPA
|
* CompleteResultBuilderEntityValued implementation specific to JPA. In JPA
|
||||||
* mappings, fetches contains also entity-identifier-related fetches - so we will
|
* mappings, fetches contains also entity-identifier-related fetches - so we will
|
||||||
|
@ -38,14 +36,14 @@ public class CompleteResultBuilderEntityJpa implements CompleteResultBuilderEnti
|
||||||
private final NavigablePath navigablePath;
|
private final NavigablePath navigablePath;
|
||||||
private final EntityMappingType entityDescriptor;
|
private final EntityMappingType entityDescriptor;
|
||||||
private final LockMode lockMode;
|
private final LockMode lockMode;
|
||||||
private final BasicValuedFetchBuilder discriminatorFetchBuilder;
|
private final FetchBuilderBasicValued discriminatorFetchBuilder;
|
||||||
private final HashMap<String, FetchBuilder> explicitFetchBuilderMap;
|
private final HashMap<String, FetchBuilder> explicitFetchBuilderMap;
|
||||||
|
|
||||||
public CompleteResultBuilderEntityJpa(
|
public CompleteResultBuilderEntityJpa(
|
||||||
NavigablePath navigablePath,
|
NavigablePath navigablePath,
|
||||||
EntityMappingType entityDescriptor,
|
EntityMappingType entityDescriptor,
|
||||||
LockMode lockMode,
|
LockMode lockMode,
|
||||||
BasicValuedFetchBuilder discriminatorFetchBuilder,
|
FetchBuilderBasicValued discriminatorFetchBuilder,
|
||||||
HashMap<String, FetchBuilder> explicitFetchBuilderMap) {
|
HashMap<String, FetchBuilder> explicitFetchBuilderMap) {
|
||||||
this.navigablePath = navigablePath;
|
this.navigablePath = navigablePath;
|
||||||
this.entityDescriptor = entityDescriptor;
|
this.entityDescriptor = entityDescriptor;
|
||||||
|
@ -87,7 +85,6 @@ public class CompleteResultBuilderEntityJpa implements CompleteResultBuilderEnti
|
||||||
public EntityResult buildResult(
|
public EntityResult buildResult(
|
||||||
JdbcValuesMetadata jdbcResultsMetadata,
|
JdbcValuesMetadata jdbcResultsMetadata,
|
||||||
int resultPosition,
|
int resultPosition,
|
||||||
BiFunction<String, String, DynamicFetchBuilderLegacy> legacyFetchResolver,
|
|
||||||
DomainResultCreationState domainResultCreationState) {
|
DomainResultCreationState domainResultCreationState) {
|
||||||
final String implicitAlias = entityDescriptor.getSqlAliasStem() + resultPosition;
|
final String implicitAlias = entityDescriptor.getSqlAliasStem() + resultPosition;
|
||||||
final SqlAliasBase sqlAliasBase = domainResultCreationState.getSqlAliasBaseManager().createSqlAliasBase( implicitAlias );
|
final SqlAliasBase sqlAliasBase = domainResultCreationState.getSqlAliasBaseManager().createSqlAliasBase( implicitAlias );
|
||||||
|
@ -126,7 +123,6 @@ public class CompleteResultBuilderEntityJpa implements CompleteResultBuilderEnti
|
||||||
entityResult,
|
entityResult,
|
||||||
navigablePath.append( EntityDiscriminatorMapping.DISCRIMINATOR_ROLE_NAME ),
|
navigablePath.append( EntityDiscriminatorMapping.DISCRIMINATOR_ROLE_NAME ),
|
||||||
jdbcResultsMetadata,
|
jdbcResultsMetadata,
|
||||||
legacyFetchResolver,
|
|
||||||
domainResultCreationState
|
domainResultCreationState
|
||||||
);
|
);
|
||||||
},
|
},
|
|
@ -2,29 +2,27 @@
|
||||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||||
* Copyright Red Hat Inc. and Hibernate Authors
|
* Copyright Red Hat Inc. and Hibernate Authors
|
||||||
*/
|
*/
|
||||||
package org.hibernate.query.results.complete;
|
package org.hibernate.query.results.internal.complete;
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.function.BiConsumer;
|
|
||||||
import java.util.function.BiFunction;
|
|
||||||
|
|
||||||
import org.hibernate.LockMode;
|
import org.hibernate.LockMode;
|
||||||
import org.hibernate.metamodel.mapping.EntityDiscriminatorMapping;
|
import org.hibernate.metamodel.mapping.EntityDiscriminatorMapping;
|
||||||
import org.hibernate.metamodel.mapping.EntityMappingType;
|
import org.hibernate.metamodel.mapping.EntityMappingType;
|
||||||
import org.hibernate.query.NativeQuery;
|
import org.hibernate.query.NativeQuery;
|
||||||
import org.hibernate.spi.NavigablePath;
|
|
||||||
import org.hibernate.query.results.BasicValuedFetchBuilder;
|
|
||||||
import org.hibernate.query.results.DomainResultCreationStateImpl;
|
|
||||||
import org.hibernate.query.results.FetchBuilder;
|
import org.hibernate.query.results.FetchBuilder;
|
||||||
|
import org.hibernate.query.results.FetchBuilderBasicValued;
|
||||||
import org.hibernate.query.results.ResultBuilder;
|
import org.hibernate.query.results.ResultBuilder;
|
||||||
import org.hibernate.query.results.ResultsHelper;
|
import org.hibernate.query.results.internal.DomainResultCreationStateImpl;
|
||||||
import org.hibernate.query.results.dynamic.DynamicFetchBuilderLegacy;
|
import org.hibernate.query.results.internal.ResultsHelper;
|
||||||
|
import org.hibernate.spi.NavigablePath;
|
||||||
import org.hibernate.sql.ast.spi.SqlAliasBaseConstant;
|
import org.hibernate.sql.ast.spi.SqlAliasBaseConstant;
|
||||||
import org.hibernate.sql.results.graph.DomainResultCreationState;
|
import org.hibernate.sql.results.graph.DomainResultCreationState;
|
||||||
import org.hibernate.sql.results.graph.entity.EntityResult;
|
import org.hibernate.sql.results.graph.entity.EntityResult;
|
||||||
import org.hibernate.sql.results.jdbc.spi.JdbcValuesMetadata;
|
import org.hibernate.sql.results.jdbc.spi.JdbcValuesMetadata;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.function.BiConsumer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
*/
|
*/
|
||||||
|
@ -33,7 +31,7 @@ public class CompleteResultBuilderEntityStandard implements CompleteResultBuilde
|
||||||
private final NavigablePath navigablePath;
|
private final NavigablePath navigablePath;
|
||||||
private final EntityMappingType entityDescriptor;
|
private final EntityMappingType entityDescriptor;
|
||||||
private final LockMode lockMode;
|
private final LockMode lockMode;
|
||||||
private final BasicValuedFetchBuilder discriminatorFetchBuilder;
|
private final FetchBuilderBasicValued discriminatorFetchBuilder;
|
||||||
private final HashMap<String, FetchBuilder> explicitFetchBuilderMap;
|
private final HashMap<String, FetchBuilder> explicitFetchBuilderMap;
|
||||||
|
|
||||||
public CompleteResultBuilderEntityStandard(
|
public CompleteResultBuilderEntityStandard(
|
||||||
|
@ -41,7 +39,7 @@ public class CompleteResultBuilderEntityStandard implements CompleteResultBuilde
|
||||||
NavigablePath navigablePath,
|
NavigablePath navigablePath,
|
||||||
EntityMappingType entityDescriptor,
|
EntityMappingType entityDescriptor,
|
||||||
LockMode lockMode,
|
LockMode lockMode,
|
||||||
BasicValuedFetchBuilder discriminatorFetchBuilder,
|
FetchBuilderBasicValued discriminatorFetchBuilder,
|
||||||
HashMap<String, FetchBuilder> explicitFetchBuilderMap) {
|
HashMap<String, FetchBuilder> explicitFetchBuilderMap) {
|
||||||
this.tableAlias = tableAlias;
|
this.tableAlias = tableAlias;
|
||||||
this.navigablePath = navigablePath;
|
this.navigablePath = navigablePath;
|
||||||
|
@ -120,7 +118,6 @@ public class CompleteResultBuilderEntityStandard implements CompleteResultBuilde
|
||||||
public EntityResult buildResult(
|
public EntityResult buildResult(
|
||||||
JdbcValuesMetadata jdbcResultsMetadata,
|
JdbcValuesMetadata jdbcResultsMetadata,
|
||||||
int resultPosition,
|
int resultPosition,
|
||||||
BiFunction<String, String, DynamicFetchBuilderLegacy> legacyFetchResolver,
|
|
||||||
DomainResultCreationState domainResultCreationState) {
|
DomainResultCreationState domainResultCreationState) {
|
||||||
final DomainResultCreationStateImpl impl = ResultsHelper.impl( domainResultCreationState );
|
final DomainResultCreationStateImpl impl = ResultsHelper.impl( domainResultCreationState );
|
||||||
impl.disallowPositionalSelections();
|
impl.disallowPositionalSelections();
|
||||||
|
@ -156,7 +153,6 @@ public class CompleteResultBuilderEntityStandard implements CompleteResultBuilde
|
||||||
entityResult,
|
entityResult,
|
||||||
navigablePath.append( EntityDiscriminatorMapping.DISCRIMINATOR_ROLE_NAME ),
|
navigablePath.append( EntityDiscriminatorMapping.DISCRIMINATOR_ROLE_NAME ),
|
||||||
jdbcResultsMetadata,
|
jdbcResultsMetadata,
|
||||||
legacyFetchResolver,
|
|
||||||
domainResultCreationState
|
domainResultCreationState
|
||||||
);
|
);
|
||||||
},
|
},
|
|
@ -2,7 +2,7 @@
|
||||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||||
* Copyright Red Hat Inc. and Hibernate Authors
|
* Copyright Red Hat Inc. and Hibernate Authors
|
||||||
*/
|
*/
|
||||||
package org.hibernate.query.results.complete;
|
package org.hibernate.query.results.internal.complete;
|
||||||
|
|
||||||
import org.hibernate.metamodel.mapping.EntityMappingType;
|
import org.hibernate.metamodel.mapping.EntityMappingType;
|
||||||
import org.hibernate.query.results.ResultBuilderEntityValued;
|
import org.hibernate.query.results.ResultBuilderEntityValued;
|
|
@ -2,16 +2,11 @@
|
||||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||||
* Copyright Red Hat Inc. and Hibernate Authors
|
* Copyright Red Hat Inc. and Hibernate Authors
|
||||||
*/
|
*/
|
||||||
package org.hibernate.query.results.complete;
|
package org.hibernate.query.results.internal.complete;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.function.BiFunction;
|
|
||||||
|
|
||||||
import org.hibernate.query.sqm.DynamicInstantiationNature;
|
|
||||||
import org.hibernate.query.results.ResultBuilderInstantiationValued;
|
|
||||||
import org.hibernate.query.results.dynamic.DynamicFetchBuilderLegacy;
|
|
||||||
import org.hibernate.query.results.ResultBuilder;
|
import org.hibernate.query.results.ResultBuilder;
|
||||||
|
import org.hibernate.query.results.ResultBuilderInstantiationValued;
|
||||||
|
import org.hibernate.query.sqm.DynamicInstantiationNature;
|
||||||
import org.hibernate.sql.results.graph.DomainResult;
|
import org.hibernate.sql.results.graph.DomainResult;
|
||||||
import org.hibernate.sql.results.graph.DomainResultCreationState;
|
import org.hibernate.sql.results.graph.DomainResultCreationState;
|
||||||
import org.hibernate.sql.results.graph.instantiation.internal.ArgumentDomainResult;
|
import org.hibernate.sql.results.graph.instantiation.internal.ArgumentDomainResult;
|
||||||
|
@ -19,6 +14,9 @@ import org.hibernate.sql.results.graph.instantiation.internal.DynamicInstantiati
|
||||||
import org.hibernate.sql.results.jdbc.spi.JdbcValuesMetadata;
|
import org.hibernate.sql.results.jdbc.spi.JdbcValuesMetadata;
|
||||||
import org.hibernate.type.descriptor.java.JavaType;
|
import org.hibernate.type.descriptor.java.JavaType;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ResultBuilder for dynamic instantiation results ({@link jakarta.persistence.ConstructorResult}
|
* ResultBuilder for dynamic instantiation results ({@link jakarta.persistence.ConstructorResult}
|
||||||
*
|
*
|
||||||
|
@ -51,7 +49,6 @@ public class CompleteResultBuilderInstantiation
|
||||||
public DomainResult<?> buildResult(
|
public DomainResult<?> buildResult(
|
||||||
JdbcValuesMetadata jdbcResultsMetadata,
|
JdbcValuesMetadata jdbcResultsMetadata,
|
||||||
int resultPosition,
|
int resultPosition,
|
||||||
BiFunction<String, String, DynamicFetchBuilderLegacy> legacyFetchResolver,
|
|
||||||
DomainResultCreationState domainResultCreationState) {
|
DomainResultCreationState domainResultCreationState) {
|
||||||
final List<ArgumentDomainResult<?>> argumentDomainResults = new ArrayList<>( argumentResultBuilders.size() );
|
final List<ArgumentDomainResult<?>> argumentDomainResults = new ArrayList<>( argumentResultBuilders.size() );
|
||||||
|
|
||||||
|
@ -62,7 +59,6 @@ public class CompleteResultBuilderInstantiation
|
||||||
argumentResultBuilder.buildResult(
|
argumentResultBuilder.buildResult(
|
||||||
jdbcResultsMetadata,
|
jdbcResultsMetadata,
|
||||||
i,
|
i,
|
||||||
legacyFetchResolver,
|
|
||||||
domainResultCreationState
|
domainResultCreationState
|
||||||
)
|
)
|
||||||
);
|
);
|
|
@ -2,28 +2,26 @@
|
||||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||||
* Copyright Red Hat Inc. and Hibernate Authors
|
* Copyright Red Hat Inc. and Hibernate Authors
|
||||||
*/
|
*/
|
||||||
package org.hibernate.query.results.complete;
|
package org.hibernate.query.results.internal.complete;
|
||||||
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.function.BiFunction;
|
|
||||||
|
|
||||||
import org.hibernate.engine.FetchTiming;
|
import org.hibernate.engine.FetchTiming;
|
||||||
import org.hibernate.metamodel.mapping.BasicValuedModelPart;
|
import org.hibernate.metamodel.mapping.BasicValuedModelPart;
|
||||||
import org.hibernate.spi.NavigablePath;
|
|
||||||
import org.hibernate.query.results.BasicValuedFetchBuilder;
|
|
||||||
import org.hibernate.query.results.FetchBuilder;
|
import org.hibernate.query.results.FetchBuilder;
|
||||||
import org.hibernate.query.results.dynamic.DynamicFetchBuilderLegacy;
|
import org.hibernate.query.results.FetchBuilderBasicValued;
|
||||||
|
import org.hibernate.spi.NavigablePath;
|
||||||
import org.hibernate.sql.results.graph.DomainResultCreationState;
|
import org.hibernate.sql.results.graph.DomainResultCreationState;
|
||||||
import org.hibernate.sql.results.graph.FetchParent;
|
import org.hibernate.sql.results.graph.FetchParent;
|
||||||
import org.hibernate.sql.results.graph.basic.BasicFetch;
|
import org.hibernate.sql.results.graph.basic.BasicFetch;
|
||||||
import org.hibernate.sql.results.jdbc.spi.JdbcValuesMetadata;
|
import org.hibernate.sql.results.jdbc.spi.JdbcValuesMetadata;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Christian Beikov
|
* @author Christian Beikov
|
||||||
*/
|
*/
|
||||||
public class DelayedFetchBuilderBasicPart
|
public class DelayedFetchBuilderBasicPart
|
||||||
implements CompleteFetchBuilder, BasicValuedFetchBuilder, ModelPartReferenceBasic {
|
implements CompleteFetchBuilder, FetchBuilderBasicValued, ModelPartReferenceBasic {
|
||||||
private final NavigablePath navigablePath;
|
private final NavigablePath navigablePath;
|
||||||
private final BasicValuedModelPart referencedModelPart;
|
private final BasicValuedModelPart referencedModelPart;
|
||||||
private final boolean isEnhancedForLazyLoading;
|
private final boolean isEnhancedForLazyLoading;
|
||||||
|
@ -57,7 +55,6 @@ public class DelayedFetchBuilderBasicPart
|
||||||
FetchParent parent,
|
FetchParent parent,
|
||||||
NavigablePath fetchPath,
|
NavigablePath fetchPath,
|
||||||
JdbcValuesMetadata jdbcResultsMetadata,
|
JdbcValuesMetadata jdbcResultsMetadata,
|
||||||
BiFunction<String, String, DynamicFetchBuilderLegacy> legacyFetchResolver,
|
|
||||||
DomainResultCreationState domainResultCreationState) {
|
DomainResultCreationState domainResultCreationState) {
|
||||||
return new BasicFetch<>(
|
return new BasicFetch<>(
|
||||||
-1,
|
-1,
|
|
@ -2,7 +2,7 @@
|
||||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||||
* Copyright Red Hat Inc. and Hibernate Authors
|
* Copyright Red Hat Inc. and Hibernate Authors
|
||||||
*/
|
*/
|
||||||
package org.hibernate.query.results.complete;
|
package org.hibernate.query.results.internal.complete;
|
||||||
|
|
||||||
import java.util.BitSet;
|
import java.util.BitSet;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
|
@ -2,7 +2,7 @@
|
||||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||||
* Copyright Red Hat Inc. and Hibernate Authors
|
* Copyright Red Hat Inc. and Hibernate Authors
|
||||||
*/
|
*/
|
||||||
package org.hibernate.query.results.complete;
|
package org.hibernate.query.results.internal.complete;
|
||||||
|
|
||||||
import org.hibernate.metamodel.mapping.ModelPart;
|
import org.hibernate.metamodel.mapping.ModelPart;
|
||||||
import org.hibernate.spi.NavigablePath;
|
import org.hibernate.spi.NavigablePath;
|
|
@ -2,7 +2,7 @@
|
||||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||||
* Copyright Red Hat Inc. and Hibernate Authors
|
* Copyright Red Hat Inc. and Hibernate Authors
|
||||||
*/
|
*/
|
||||||
package org.hibernate.query.results.complete;
|
package org.hibernate.query.results.internal.complete;
|
||||||
|
|
||||||
import org.hibernate.metamodel.mapping.BasicValuedModelPart;
|
import org.hibernate.metamodel.mapping.BasicValuedModelPart;
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||||
* Copyright Red Hat Inc. and Hibernate Authors
|
* Copyright Red Hat Inc. and Hibernate Authors
|
||||||
*/
|
*/
|
||||||
package org.hibernate.query.results.complete;
|
package org.hibernate.query.results.internal.complete;
|
||||||
|
|
||||||
import org.hibernate.metamodel.mapping.PluralAttributeMapping;
|
import org.hibernate.metamodel.mapping.PluralAttributeMapping;
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||||
* Copyright Red Hat Inc. and Hibernate Authors
|
* Copyright Red Hat Inc. and Hibernate Authors
|
||||||
*/
|
*/
|
||||||
package org.hibernate.query.results.complete;
|
package org.hibernate.query.results.internal.complete;
|
||||||
|
|
||||||
import org.hibernate.metamodel.mapping.EmbeddableValuedModelPart;
|
import org.hibernate.metamodel.mapping.EmbeddableValuedModelPart;
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||||
* Copyright Red Hat Inc. and Hibernate Authors
|
* Copyright Red Hat Inc. and Hibernate Authors
|
||||||
*/
|
*/
|
||||||
package org.hibernate.query.results.complete;
|
package org.hibernate.query.results.internal.complete;
|
||||||
|
|
||||||
import org.hibernate.metamodel.mapping.EntityValuedModelPart;
|
import org.hibernate.metamodel.mapping.EntityValuedModelPart;
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
/*
|
||||||
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
|
*
|
||||||
|
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||||
|
* See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Support for immutable result/fetch builder graph nodes built from static sources
|
||||||
|
* such as {@link jakarta.persistence.SqlResultSetMapping}, {@code orm.xml},
|
||||||
|
* {@code mapping.xml} or {@code hbm.xml}.
|
||||||
|
*/
|
||||||
|
package org.hibernate.query.results.internal.complete;
|
|
@ -2,7 +2,7 @@
|
||||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||||
* Copyright Red Hat Inc. and Hibernate Authors
|
* Copyright Red Hat Inc. and Hibernate Authors
|
||||||
*/
|
*/
|
||||||
package org.hibernate.query.results.dynamic;
|
package org.hibernate.query.results.internal.dynamic;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
|
@ -2,7 +2,7 @@
|
||||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||||
* Copyright Red Hat Inc. and Hibernate Authors
|
* Copyright Red Hat Inc. and Hibernate Authors
|
||||||
*/
|
*/
|
||||||
package org.hibernate.query.results.dynamic;
|
package org.hibernate.query.results.internal.dynamic;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||||
* Copyright Red Hat Inc. and Hibernate Authors
|
* Copyright Red Hat Inc. and Hibernate Authors
|
||||||
*/
|
*/
|
||||||
package org.hibernate.query.results.dynamic;
|
package org.hibernate.query.results.internal.dynamic;
|
||||||
|
|
||||||
import org.hibernate.query.results.FetchBuilder;
|
import org.hibernate.query.results.FetchBuilder;
|
||||||
|
|
|
@ -2,14 +2,7 @@
|
||||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||||
* Copyright Red Hat Inc. and Hibernate Authors
|
* Copyright Red Hat Inc. and Hibernate Authors
|
||||||
*/
|
*/
|
||||||
package org.hibernate.query.results.dynamic;
|
package org.hibernate.query.results.internal.dynamic;
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.function.BiConsumer;
|
|
||||||
import java.util.function.BiFunction;
|
|
||||||
|
|
||||||
import org.hibernate.LockMode;
|
import org.hibernate.LockMode;
|
||||||
import org.hibernate.engine.FetchTiming;
|
import org.hibernate.engine.FetchTiming;
|
||||||
|
@ -20,9 +13,10 @@ import org.hibernate.metamodel.mapping.PluralAttributeMapping;
|
||||||
import org.hibernate.metamodel.mapping.SelectableMapping;
|
import org.hibernate.metamodel.mapping.SelectableMapping;
|
||||||
import org.hibernate.metamodel.mapping.internal.ToOneAttributeMapping;
|
import org.hibernate.metamodel.mapping.internal.ToOneAttributeMapping;
|
||||||
import org.hibernate.query.NativeQuery;
|
import org.hibernate.query.NativeQuery;
|
||||||
import org.hibernate.query.results.DomainResultCreationStateImpl;
|
|
||||||
import org.hibernate.query.results.FetchBuilder;
|
import org.hibernate.query.results.FetchBuilder;
|
||||||
import org.hibernate.query.results.ResultsHelper;
|
import org.hibernate.query.results.LegacyFetchBuilder;
|
||||||
|
import org.hibernate.query.results.internal.DomainResultCreationStateImpl;
|
||||||
|
import org.hibernate.query.results.internal.ResultsHelper;
|
||||||
import org.hibernate.spi.NavigablePath;
|
import org.hibernate.spi.NavigablePath;
|
||||||
import org.hibernate.sql.ast.SqlAstJoinType;
|
import org.hibernate.sql.ast.SqlAstJoinType;
|
||||||
import org.hibernate.sql.ast.spi.SqlAliasBase;
|
import org.hibernate.sql.ast.spi.SqlAliasBase;
|
||||||
|
@ -36,13 +30,20 @@ import org.hibernate.sql.results.graph.Fetch;
|
||||||
import org.hibernate.sql.results.graph.FetchParent;
|
import org.hibernate.sql.results.graph.FetchParent;
|
||||||
import org.hibernate.sql.results.jdbc.spi.JdbcValuesMetadata;
|
import org.hibernate.sql.results.jdbc.spi.JdbcValuesMetadata;
|
||||||
|
|
||||||
import static org.hibernate.query.results.ResultsHelper.impl;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.function.BiConsumer;
|
||||||
|
|
||||||
|
import static org.hibernate.query.results.internal.ResultsHelper.impl;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
* @author Christian Beikov
|
* @author Christian Beikov
|
||||||
*/
|
*/
|
||||||
public class DynamicFetchBuilderLegacy implements DynamicFetchBuilder, NativeQuery.FetchReturn, DynamicFetchBuilderContainer {
|
public class DynamicFetchBuilderLegacy
|
||||||
|
implements LegacyFetchBuilder, DynamicFetchBuilder, NativeQuery.FetchReturn, NativeQuery.ReturnableResultNode, DynamicFetchBuilderContainer {
|
||||||
|
|
||||||
private static final String ELEMENT_PREFIX = CollectionPart.Nature.ELEMENT.getName() + ".";
|
private static final String ELEMENT_PREFIX = CollectionPart.Nature.ELEMENT.getName() + ".";
|
||||||
private static final String INDEX_PREFIX = CollectionPart.Nature.INDEX.getName() + ".";
|
private static final String INDEX_PREFIX = CollectionPart.Nature.INDEX.getName() + ".";
|
||||||
|
@ -124,7 +125,6 @@ public class DynamicFetchBuilderLegacy implements DynamicFetchBuilder, NativeQue
|
||||||
FetchParent parent,
|
FetchParent parent,
|
||||||
NavigablePath fetchPath,
|
NavigablePath fetchPath,
|
||||||
JdbcValuesMetadata jdbcResultsMetadata,
|
JdbcValuesMetadata jdbcResultsMetadata,
|
||||||
BiFunction<String, String, DynamicFetchBuilderLegacy> legacyFetchResolver,
|
|
||||||
DomainResultCreationState domainResultCreationState) {
|
DomainResultCreationState domainResultCreationState) {
|
||||||
final DomainResultCreationStateImpl creationState = impl( domainResultCreationState );
|
final DomainResultCreationStateImpl creationState = impl( domainResultCreationState );
|
||||||
final TableGroup ownerTableGroup = creationState.getFromClauseAccess().findByAlias( ownerTableAlias );
|
final TableGroup ownerTableGroup = creationState.getFromClauseAccess().findByAlias( ownerTableAlias );
|
||||||
|
@ -153,8 +153,7 @@ public class DynamicFetchBuilderLegacy implements DynamicFetchBuilder, NativeQue
|
||||||
|
|
||||||
if ( columnNames != null ) {
|
if ( columnNames != null ) {
|
||||||
final ForeignKeyDescriptor keyDescriptor;
|
final ForeignKeyDescriptor keyDescriptor;
|
||||||
if ( attributeMapping instanceof PluralAttributeMapping ) {
|
if ( attributeMapping instanceof PluralAttributeMapping pluralAttributeMapping ) {
|
||||||
final PluralAttributeMapping pluralAttributeMapping = (PluralAttributeMapping) attributeMapping;
|
|
||||||
keyDescriptor = pluralAttributeMapping.getKeyDescriptor();
|
keyDescriptor = pluralAttributeMapping.getKeyDescriptor();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -166,8 +165,7 @@ public class DynamicFetchBuilderLegacy implements DynamicFetchBuilder, NativeQue
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !columnNames.isEmpty() ) {
|
if ( !columnNames.isEmpty() ) {
|
||||||
keyDescriptor.forEachSelectable(
|
keyDescriptor.forEachSelectable( (selectionIndex, selectableMapping) -> {
|
||||||
(selectionIndex, selectableMapping) -> {
|
|
||||||
resolveSqlSelection(
|
resolveSqlSelection(
|
||||||
columnNames.get( selectionIndex ),
|
columnNames.get( selectionIndex ),
|
||||||
tableGroup.resolveTableReference(
|
tableGroup.resolveTableReference(
|
||||||
|
@ -178,8 +176,7 @@ public class DynamicFetchBuilderLegacy implements DynamicFetchBuilder, NativeQue
|
||||||
selectableMapping,
|
selectableMapping,
|
||||||
jdbcResultsMetadata,
|
jdbcResultsMetadata,
|
||||||
domainResultCreationState
|
domainResultCreationState
|
||||||
);
|
); }
|
||||||
}
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,11 +2,7 @@
|
||||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||||
* Copyright Red Hat Inc. and Hibernate Authors
|
* Copyright Red Hat Inc. and Hibernate Authors
|
||||||
*/
|
*/
|
||||||
package org.hibernate.query.results.dynamic;
|
package org.hibernate.query.results.internal.dynamic;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.function.BiFunction;
|
|
||||||
|
|
||||||
import org.hibernate.engine.FetchTiming;
|
import org.hibernate.engine.FetchTiming;
|
||||||
import org.hibernate.metamodel.mapping.BasicValuedModelPart;
|
import org.hibernate.metamodel.mapping.BasicValuedModelPart;
|
||||||
|
@ -15,9 +11,9 @@ import org.hibernate.metamodel.mapping.SelectableConsumer;
|
||||||
import org.hibernate.metamodel.mapping.ValuedModelPart;
|
import org.hibernate.metamodel.mapping.ValuedModelPart;
|
||||||
import org.hibernate.metamodel.mapping.internal.ToOneAttributeMapping;
|
import org.hibernate.metamodel.mapping.internal.ToOneAttributeMapping;
|
||||||
import org.hibernate.query.NativeQuery;
|
import org.hibernate.query.NativeQuery;
|
||||||
|
import org.hibernate.query.results.internal.DomainResultCreationStateImpl;
|
||||||
|
import org.hibernate.query.results.internal.ResultsHelper;
|
||||||
import org.hibernate.spi.NavigablePath;
|
import org.hibernate.spi.NavigablePath;
|
||||||
import org.hibernate.query.results.DomainResultCreationStateImpl;
|
|
||||||
import org.hibernate.query.results.ResultsHelper;
|
|
||||||
import org.hibernate.sql.ast.spi.SqlExpressionResolver;
|
import org.hibernate.sql.ast.spi.SqlExpressionResolver;
|
||||||
import org.hibernate.sql.ast.tree.from.TableGroup;
|
import org.hibernate.sql.ast.tree.from.TableGroup;
|
||||||
import org.hibernate.sql.ast.tree.from.TableReference;
|
import org.hibernate.sql.ast.tree.from.TableReference;
|
||||||
|
@ -28,6 +24,9 @@ import org.hibernate.sql.results.graph.Fetchable;
|
||||||
import org.hibernate.sql.results.graph.embeddable.EmbeddableValuedFetchable;
|
import org.hibernate.sql.results.graph.embeddable.EmbeddableValuedFetchable;
|
||||||
import org.hibernate.sql.results.jdbc.spi.JdbcValuesMetadata;
|
import org.hibernate.sql.results.jdbc.spi.JdbcValuesMetadata;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
|
@ -69,7 +68,6 @@ public class DynamicFetchBuilderStandard
|
||||||
FetchParent parent,
|
FetchParent parent,
|
||||||
NavigablePath fetchPath,
|
NavigablePath fetchPath,
|
||||||
JdbcValuesMetadata jdbcResultsMetadata,
|
JdbcValuesMetadata jdbcResultsMetadata,
|
||||||
BiFunction<String, String, DynamicFetchBuilderLegacy> legacyFetchResolver,
|
|
||||||
DomainResultCreationState domainResultCreationState) {
|
DomainResultCreationState domainResultCreationState) {
|
||||||
final DomainResultCreationStateImpl creationStateImpl = ResultsHelper.impl( domainResultCreationState );
|
final DomainResultCreationStateImpl creationStateImpl = ResultsHelper.impl( domainResultCreationState );
|
||||||
|
|
||||||
|
@ -121,8 +119,7 @@ public class DynamicFetchBuilderStandard
|
||||||
creationStateImpl
|
creationStateImpl
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else if ( attributeMapping instanceof ToOneAttributeMapping ) {
|
else if ( attributeMapping instanceof ToOneAttributeMapping toOneAttributeMapping ) {
|
||||||
final ToOneAttributeMapping toOneAttributeMapping = (ToOneAttributeMapping) attributeMapping;
|
|
||||||
toOneAttributeMapping.getForeignKeyDescriptor().getPart( toOneAttributeMapping.getSideNature() )
|
toOneAttributeMapping.getForeignKeyDescriptor().getPart( toOneAttributeMapping.getSideNature() )
|
||||||
.forEachSelectable(
|
.forEachSelectable(
|
||||||
getSelectableConsumer(
|
getSelectableConsumer(
|
|
@ -2,7 +2,7 @@
|
||||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||||
* Copyright Red Hat Inc. and Hibernate Authors
|
* Copyright Red Hat Inc. and Hibernate Authors
|
||||||
*/
|
*/
|
||||||
package org.hibernate.query.results.dynamic;
|
package org.hibernate.query.results.internal.dynamic;
|
||||||
|
|
||||||
import org.hibernate.query.NativeQuery;
|
import org.hibernate.query.NativeQuery;
|
||||||
import org.hibernate.query.results.ResultBuilder;
|
import org.hibernate.query.results.ResultBuilder;
|
|
@ -2,16 +2,13 @@
|
||||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||||
* Copyright Red Hat Inc. and Hibernate Authors
|
* Copyright Red Hat Inc. and Hibernate Authors
|
||||||
*/
|
*/
|
||||||
package org.hibernate.query.results.dynamic;
|
package org.hibernate.query.results.internal.dynamic;
|
||||||
|
|
||||||
import java.util.Locale;
|
|
||||||
import java.util.function.BiFunction;
|
|
||||||
|
|
||||||
import org.hibernate.metamodel.mapping.SingularAttributeMapping;
|
import org.hibernate.metamodel.mapping.SingularAttributeMapping;
|
||||||
import org.hibernate.metamodel.mapping.internal.BasicAttributeMapping;
|
import org.hibernate.metamodel.mapping.internal.BasicAttributeMapping;
|
||||||
import org.hibernate.query.NativeQuery;
|
import org.hibernate.query.NativeQuery;
|
||||||
import org.hibernate.query.results.DomainResultCreationStateImpl;
|
import org.hibernate.query.results.internal.DomainResultCreationStateImpl;
|
||||||
import org.hibernate.query.results.ResultSetMappingSqlSelection;
|
import org.hibernate.query.results.internal.ResultSetMappingSqlSelection;
|
||||||
import org.hibernate.sql.ast.spi.SqlExpressionResolver;
|
import org.hibernate.sql.ast.spi.SqlExpressionResolver;
|
||||||
import org.hibernate.sql.ast.spi.SqlSelection;
|
import org.hibernate.sql.ast.spi.SqlSelection;
|
||||||
import org.hibernate.sql.results.graph.DomainResult;
|
import org.hibernate.sql.results.graph.DomainResult;
|
||||||
|
@ -19,8 +16,10 @@ import org.hibernate.sql.results.graph.DomainResultCreationState;
|
||||||
import org.hibernate.sql.results.graph.basic.BasicResult;
|
import org.hibernate.sql.results.graph.basic.BasicResult;
|
||||||
import org.hibernate.sql.results.jdbc.spi.JdbcValuesMetadata;
|
import org.hibernate.sql.results.jdbc.spi.JdbcValuesMetadata;
|
||||||
|
|
||||||
import static org.hibernate.query.results.ResultsHelper.impl;
|
import java.util.Locale;
|
||||||
import static org.hibernate.query.results.ResultsHelper.jdbcPositionToValuesArrayPosition;
|
|
||||||
|
import static org.hibernate.query.results.internal.ResultsHelper.impl;
|
||||||
|
import static org.hibernate.query.results.internal.ResultsHelper.jdbcPositionToValuesArrayPosition;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DynamicResultBuilder based on a named mapped attribute
|
* DynamicResultBuilder based on a named mapped attribute
|
||||||
|
@ -76,7 +75,6 @@ public class DynamicResultBuilderAttribute implements DynamicResultBuilder, Nati
|
||||||
public DomainResult<?> buildResult(
|
public DomainResult<?> buildResult(
|
||||||
JdbcValuesMetadata jdbcResultsMetadata,
|
JdbcValuesMetadata jdbcResultsMetadata,
|
||||||
int resultPosition,
|
int resultPosition,
|
||||||
BiFunction<String, String, DynamicFetchBuilderLegacy> legacyFetchResolver,
|
|
||||||
DomainResultCreationState domainResultCreationState) {
|
DomainResultCreationState domainResultCreationState) {
|
||||||
final DomainResultCreationStateImpl domainResultCreationStateImpl = impl( domainResultCreationState );
|
final DomainResultCreationStateImpl domainResultCreationStateImpl = impl( domainResultCreationState );
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||||
* Copyright Red Hat Inc. and Hibernate Authors
|
* Copyright Red Hat Inc. and Hibernate Authors
|
||||||
*/
|
*/
|
||||||
package org.hibernate.query.results.dynamic;
|
package org.hibernate.query.results.internal.dynamic;
|
||||||
|
|
||||||
import org.hibernate.query.results.ResultBuilderBasicValued;
|
import org.hibernate.query.results.ResultBuilderBasicValued;
|
||||||
|
|
|
@ -2,19 +2,13 @@
|
||||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||||
* Copyright Red Hat Inc. and Hibernate Authors
|
* Copyright Red Hat Inc. and Hibernate Authors
|
||||||
*/
|
*/
|
||||||
package org.hibernate.query.results.dynamic;
|
package org.hibernate.query.results.internal.dynamic;
|
||||||
|
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.function.BiFunction;
|
|
||||||
|
|
||||||
import jakarta.persistence.AttributeConverter;
|
import jakarta.persistence.AttributeConverter;
|
||||||
|
|
||||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
import org.hibernate.metamodel.mapping.BasicValuedMapping;
|
import org.hibernate.metamodel.mapping.BasicValuedMapping;
|
||||||
import org.hibernate.type.descriptor.converter.internal.JpaAttributeConverterImpl;
|
import org.hibernate.query.results.internal.ResultSetMappingSqlSelection;
|
||||||
import org.hibernate.type.descriptor.converter.spi.BasicValueConverter;
|
import org.hibernate.query.results.internal.ResultsHelper;
|
||||||
import org.hibernate.query.results.ResultsHelper;
|
|
||||||
import org.hibernate.query.results.ResultSetMappingSqlSelection;
|
|
||||||
import org.hibernate.resource.beans.spi.ManagedBean;
|
import org.hibernate.resource.beans.spi.ManagedBean;
|
||||||
import org.hibernate.resource.beans.spi.ManagedBeanRegistry;
|
import org.hibernate.resource.beans.spi.ManagedBeanRegistry;
|
||||||
import org.hibernate.resource.beans.spi.ProvidedInstanceManagedBeanImpl;
|
import org.hibernate.resource.beans.spi.ProvidedInstanceManagedBeanImpl;
|
||||||
|
@ -24,10 +18,14 @@ import org.hibernate.sql.results.graph.DomainResultCreationState;
|
||||||
import org.hibernate.sql.results.graph.basic.BasicResult;
|
import org.hibernate.sql.results.graph.basic.BasicResult;
|
||||||
import org.hibernate.sql.results.jdbc.spi.JdbcValuesMetadata;
|
import org.hibernate.sql.results.jdbc.spi.JdbcValuesMetadata;
|
||||||
import org.hibernate.type.BasicType;
|
import org.hibernate.type.BasicType;
|
||||||
|
import org.hibernate.type.descriptor.converter.internal.JpaAttributeConverterImpl;
|
||||||
|
import org.hibernate.type.descriptor.converter.spi.BasicValueConverter;
|
||||||
import org.hibernate.type.descriptor.java.JavaType;
|
import org.hibernate.type.descriptor.java.JavaType;
|
||||||
import org.hibernate.type.descriptor.java.spi.JavaTypeRegistry;
|
import org.hibernate.type.descriptor.java.spi.JavaTypeRegistry;
|
||||||
import org.hibernate.type.spi.TypeConfiguration;
|
import org.hibernate.type.spi.TypeConfiguration;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A ResultBuilder for explicitly converted scalar results
|
* A ResultBuilder for explicitly converted scalar results
|
||||||
*
|
*
|
||||||
|
@ -84,7 +82,7 @@ public class DynamicResultBuilderBasicConverted<O,R> implements DynamicResultBui
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DynamicResultBuilderBasicConverted cacheKeyInstance() {
|
public DynamicResultBuilderBasicConverted<?,?> cacheKeyInstance() {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,7 +90,6 @@ public class DynamicResultBuilderBasicConverted<O,R> implements DynamicResultBui
|
||||||
public BasicResult<?> buildResult(
|
public BasicResult<?> buildResult(
|
||||||
JdbcValuesMetadata jdbcResultsMetadata,
|
JdbcValuesMetadata jdbcResultsMetadata,
|
||||||
int resultPosition,
|
int resultPosition,
|
||||||
BiFunction<String, String, DynamicFetchBuilderLegacy> legacyFetchResolver,
|
|
||||||
DomainResultCreationState domainResultCreationState) {
|
DomainResultCreationState domainResultCreationState) {
|
||||||
final TypeConfiguration typeConfiguration = domainResultCreationState.getSqlAstCreationState()
|
final TypeConfiguration typeConfiguration = domainResultCreationState.getSqlAstCreationState()
|
||||||
.getCreationContext()
|
.getCreationContext()
|
|
@ -2,18 +2,14 @@
|
||||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||||
* Copyright Red Hat Inc. and Hibernate Authors
|
* Copyright Red Hat Inc. and Hibernate Authors
|
||||||
*/
|
*/
|
||||||
package org.hibernate.query.results.dynamic;
|
package org.hibernate.query.results.internal.dynamic;
|
||||||
|
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.function.BiFunction;
|
|
||||||
|
|
||||||
import org.hibernate.metamodel.mapping.JdbcMapping;
|
|
||||||
import org.hibernate.type.descriptor.converter.spi.BasicValueConverter;
|
|
||||||
import org.hibernate.query.NativeQuery;
|
|
||||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
import org.hibernate.metamodel.mapping.BasicValuedMapping;
|
import org.hibernate.metamodel.mapping.BasicValuedMapping;
|
||||||
import org.hibernate.query.results.ResultsHelper;
|
import org.hibernate.metamodel.mapping.JdbcMapping;
|
||||||
import org.hibernate.query.results.ResultSetMappingSqlSelection;
|
import org.hibernate.query.NativeQuery;
|
||||||
|
import org.hibernate.query.results.internal.ResultSetMappingSqlSelection;
|
||||||
|
import org.hibernate.query.results.internal.ResultsHelper;
|
||||||
import org.hibernate.sql.ast.spi.SqlExpressionResolver;
|
import org.hibernate.sql.ast.spi.SqlExpressionResolver;
|
||||||
import org.hibernate.sql.ast.spi.SqlSelection;
|
import org.hibernate.sql.ast.spi.SqlSelection;
|
||||||
import org.hibernate.sql.ast.tree.expression.Expression;
|
import org.hibernate.sql.ast.tree.expression.Expression;
|
||||||
|
@ -21,8 +17,11 @@ import org.hibernate.sql.results.graph.DomainResultCreationState;
|
||||||
import org.hibernate.sql.results.graph.basic.BasicResult;
|
import org.hibernate.sql.results.graph.basic.BasicResult;
|
||||||
import org.hibernate.sql.results.jdbc.spi.JdbcValuesMetadata;
|
import org.hibernate.sql.results.jdbc.spi.JdbcValuesMetadata;
|
||||||
import org.hibernate.type.BasicType;
|
import org.hibernate.type.BasicType;
|
||||||
|
import org.hibernate.type.descriptor.converter.spi.BasicValueConverter;
|
||||||
import org.hibernate.type.descriptor.java.JavaType;
|
import org.hibernate.type.descriptor.java.JavaType;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Standard DynamicResultBuilder for basic values.
|
* Standard DynamicResultBuilder for basic values.
|
||||||
*
|
*
|
||||||
|
@ -118,7 +117,6 @@ public class DynamicResultBuilderBasicStandard implements DynamicResultBuilderBa
|
||||||
public BasicResult<?> buildResult(
|
public BasicResult<?> buildResult(
|
||||||
JdbcValuesMetadata jdbcResultsMetadata,
|
JdbcValuesMetadata jdbcResultsMetadata,
|
||||||
int resultPosition,
|
int resultPosition,
|
||||||
BiFunction<String, String, DynamicFetchBuilderLegacy> legacyFetchResolver,
|
|
||||||
DomainResultCreationState domainResultCreationState) {
|
DomainResultCreationState domainResultCreationState) {
|
||||||
final SessionFactoryImplementor sessionFactory = domainResultCreationState.getSqlAstCreationState()
|
final SessionFactoryImplementor sessionFactory = domainResultCreationState.getSqlAstCreationState()
|
||||||
.getCreationContext()
|
.getCreationContext()
|
|
@ -2,9 +2,7 @@
|
||||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||||
* Copyright Red Hat Inc. and Hibernate Authors
|
* Copyright Red Hat Inc. and Hibernate Authors
|
||||||
*/
|
*/
|
||||||
package org.hibernate.query.results.dynamic;
|
package org.hibernate.query.results.internal.dynamic;
|
||||||
|
|
||||||
import java.util.function.BiFunction;
|
|
||||||
|
|
||||||
import org.hibernate.query.results.ResultBuilderEntityValued;
|
import org.hibernate.query.results.ResultBuilderEntityValued;
|
||||||
import org.hibernate.sql.results.graph.DomainResultCreationState;
|
import org.hibernate.sql.results.graph.DomainResultCreationState;
|
||||||
|
@ -19,6 +17,5 @@ public interface DynamicResultBuilderEntity extends DynamicResultBuilder, Result
|
||||||
EntityResult buildResult(
|
EntityResult buildResult(
|
||||||
JdbcValuesMetadata jdbcResultsMetadata,
|
JdbcValuesMetadata jdbcResultsMetadata,
|
||||||
int resultPosition,
|
int resultPosition,
|
||||||
BiFunction<String, String, DynamicFetchBuilderLegacy> legacyFetchResolver,
|
|
||||||
DomainResultCreationState domainResultCreationState);
|
DomainResultCreationState domainResultCreationState);
|
||||||
}
|
}
|
|
@ -2,15 +2,13 @@
|
||||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||||
* Copyright Red Hat Inc. and Hibernate Authors
|
* Copyright Red Hat Inc. and Hibernate Authors
|
||||||
*/
|
*/
|
||||||
package org.hibernate.query.results.dynamic;
|
package org.hibernate.query.results.internal.dynamic;
|
||||||
|
|
||||||
import java.util.function.BiFunction;
|
|
||||||
|
|
||||||
import org.hibernate.LockMode;
|
import org.hibernate.LockMode;
|
||||||
import org.hibernate.metamodel.mapping.EntityMappingType;
|
import org.hibernate.metamodel.mapping.EntityMappingType;
|
||||||
import org.hibernate.query.NativeQuery;
|
import org.hibernate.query.NativeQuery;
|
||||||
import org.hibernate.query.results.DomainResultCreationStateImpl;
|
import org.hibernate.query.results.internal.DomainResultCreationStateImpl;
|
||||||
import org.hibernate.query.results.ResultsHelper;
|
import org.hibernate.query.results.internal.ResultsHelper;
|
||||||
import org.hibernate.spi.NavigablePath;
|
import org.hibernate.spi.NavigablePath;
|
||||||
import org.hibernate.sql.ast.spi.SqlAliasBaseConstant;
|
import org.hibernate.sql.ast.spi.SqlAliasBaseConstant;
|
||||||
import org.hibernate.sql.ast.tree.from.TableGroup;
|
import org.hibernate.sql.ast.tree.from.TableGroup;
|
||||||
|
@ -106,7 +104,6 @@ public class DynamicResultBuilderEntityCalculated implements DynamicResultBuilde
|
||||||
public EntityResult buildResult(
|
public EntityResult buildResult(
|
||||||
JdbcValuesMetadata jdbcResultsMetadata,
|
JdbcValuesMetadata jdbcResultsMetadata,
|
||||||
int resultPosition,
|
int resultPosition,
|
||||||
BiFunction<String, String, DynamicFetchBuilderLegacy> legacyFetchResolver,
|
|
||||||
DomainResultCreationState domainResultCreationState) {
|
DomainResultCreationState domainResultCreationState) {
|
||||||
final DomainResultCreationStateImpl creationStateImpl = ResultsHelper.impl( domainResultCreationState );
|
final DomainResultCreationStateImpl creationStateImpl = ResultsHelper.impl( domainResultCreationState );
|
||||||
|
|
|
@ -2,15 +2,7 @@
|
||||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||||
* Copyright Red Hat Inc. and Hibernate Authors
|
* Copyright Red Hat Inc. and Hibernate Authors
|
||||||
*/
|
*/
|
||||||
package org.hibernate.query.results.dynamic;
|
package org.hibernate.query.results.internal.dynamic;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.function.BiFunction;
|
|
||||||
import java.util.function.Function;
|
|
||||||
|
|
||||||
import org.hibernate.LockMode;
|
import org.hibernate.LockMode;
|
||||||
import org.hibernate.engine.FetchTiming;
|
import org.hibernate.engine.FetchTiming;
|
||||||
|
@ -23,10 +15,10 @@ import org.hibernate.metamodel.mapping.SelectableMapping;
|
||||||
import org.hibernate.metamodel.mapping.internal.ManyToManyCollectionPart;
|
import org.hibernate.metamodel.mapping.internal.ManyToManyCollectionPart;
|
||||||
import org.hibernate.metamodel.mapping.internal.SingleAttributeIdentifierMapping;
|
import org.hibernate.metamodel.mapping.internal.SingleAttributeIdentifierMapping;
|
||||||
import org.hibernate.query.NativeQuery;
|
import org.hibernate.query.NativeQuery;
|
||||||
import org.hibernate.query.results.DomainResultCreationStateImpl;
|
|
||||||
import org.hibernate.query.results.FetchBuilder;
|
import org.hibernate.query.results.FetchBuilder;
|
||||||
import org.hibernate.query.results.ResultsHelper;
|
import org.hibernate.query.results.internal.DomainResultCreationStateImpl;
|
||||||
import org.hibernate.query.results.complete.CompleteFetchBuilder;
|
import org.hibernate.query.results.internal.ResultsHelper;
|
||||||
|
import org.hibernate.query.results.internal.complete.CompleteFetchBuilder;
|
||||||
import org.hibernate.spi.NavigablePath;
|
import org.hibernate.spi.NavigablePath;
|
||||||
import org.hibernate.sql.ast.spi.FromClauseAccess;
|
import org.hibernate.sql.ast.spi.FromClauseAccess;
|
||||||
import org.hibernate.sql.ast.spi.SqlAliasBaseConstant;
|
import org.hibernate.sql.ast.spi.SqlAliasBaseConstant;
|
||||||
|
@ -39,7 +31,14 @@ import org.hibernate.sql.results.graph.Fetchable;
|
||||||
import org.hibernate.sql.results.graph.entity.EntityResult;
|
import org.hibernate.sql.results.graph.entity.EntityResult;
|
||||||
import org.hibernate.sql.results.jdbc.spi.JdbcValuesMetadata;
|
import org.hibernate.sql.results.jdbc.spi.JdbcValuesMetadata;
|
||||||
|
|
||||||
import static org.hibernate.query.results.ResultsHelper.impl;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.function.Function;
|
||||||
|
|
||||||
|
import static org.hibernate.query.results.internal.ResultsHelper.impl;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
|
@ -138,7 +137,6 @@ public class DynamicResultBuilderEntityStandard
|
||||||
public EntityResult buildResult(
|
public EntityResult buildResult(
|
||||||
JdbcValuesMetadata jdbcResultsMetadata,
|
JdbcValuesMetadata jdbcResultsMetadata,
|
||||||
int resultPosition,
|
int resultPosition,
|
||||||
BiFunction<String, String, DynamicFetchBuilderLegacy> legacyFetchResolver,
|
|
||||||
DomainResultCreationState domainResultCreationState) {
|
DomainResultCreationState domainResultCreationState) {
|
||||||
return buildResultOrFetch(
|
return buildResultOrFetch(
|
||||||
(tableGroup) -> (EntityResult) entityMapping.createDomainResult(
|
(tableGroup) -> (EntityResult) entityMapping.createDomainResult(
|
||||||
|
@ -221,8 +219,7 @@ public class DynamicResultBuilderEntityStandard
|
||||||
if ( keyColumnAliases != null ) {
|
if ( keyColumnAliases != null ) {
|
||||||
final ModelPart keyPart;
|
final ModelPart keyPart;
|
||||||
final TableGroup keyTableGroup;
|
final TableGroup keyTableGroup;
|
||||||
if ( fetchable instanceof PluralAttributeMapping ) {
|
if ( fetchable instanceof PluralAttributeMapping pluralAttributeMapping ) {
|
||||||
final PluralAttributeMapping pluralAttributeMapping = (PluralAttributeMapping) fetchable;
|
|
||||||
if ( pluralAttributeMapping.getCollectionDescriptor().isOneToMany() ) {
|
if ( pluralAttributeMapping.getCollectionDescriptor().isOneToMany() ) {
|
||||||
keyPart = entityMapping.getIdentifierMapping();
|
keyPart = entityMapping.getIdentifierMapping();
|
||||||
keyTableGroup = tableGroup;
|
keyTableGroup = tableGroup;
|
|
@ -2,16 +2,12 @@
|
||||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||||
* Copyright Red Hat Inc. and Hibernate Authors
|
* Copyright Red Hat Inc. and Hibernate Authors
|
||||||
*/
|
*/
|
||||||
package org.hibernate.query.results.dynamic;
|
package org.hibernate.query.results.internal.dynamic;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.function.BiFunction;
|
|
||||||
|
|
||||||
import org.hibernate.query.sqm.DynamicInstantiationNature;
|
|
||||||
import org.hibernate.query.NativeQuery;
|
import org.hibernate.query.NativeQuery;
|
||||||
import org.hibernate.query.results.Builders;
|
import org.hibernate.query.results.internal.Builders;
|
||||||
import org.hibernate.query.results.ResultBuilderInstantiationValued;
|
import org.hibernate.query.results.ResultBuilderInstantiationValued;
|
||||||
|
import org.hibernate.query.sqm.DynamicInstantiationNature;
|
||||||
import org.hibernate.sql.results.graph.DomainResult;
|
import org.hibernate.sql.results.graph.DomainResult;
|
||||||
import org.hibernate.sql.results.graph.DomainResultCreationState;
|
import org.hibernate.sql.results.graph.DomainResultCreationState;
|
||||||
import org.hibernate.sql.results.graph.instantiation.internal.ArgumentDomainResult;
|
import org.hibernate.sql.results.graph.instantiation.internal.ArgumentDomainResult;
|
||||||
|
@ -19,6 +15,9 @@ import org.hibernate.sql.results.graph.instantiation.internal.DynamicInstantiati
|
||||||
import org.hibernate.sql.results.jdbc.spi.JdbcValuesMetadata;
|
import org.hibernate.sql.results.jdbc.spi.JdbcValuesMetadata;
|
||||||
import org.hibernate.type.descriptor.java.JavaType;
|
import org.hibernate.type.descriptor.java.JavaType;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
*/
|
*/
|
||||||
|
@ -96,15 +95,14 @@ public class DynamicResultBuilderInstantiation<J>
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DynamicResultBuilderInstantiation cacheKeyInstance() {
|
public DynamicResultBuilderInstantiation<?> cacheKeyInstance() {
|
||||||
return new DynamicResultBuilderInstantiation( this );
|
return new DynamicResultBuilderInstantiation<>( this );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DomainResult<?> buildResult(
|
public DomainResult<?> buildResult(
|
||||||
JdbcValuesMetadata jdbcResultsMetadata,
|
JdbcValuesMetadata jdbcResultsMetadata,
|
||||||
int resultPosition,
|
int resultPosition,
|
||||||
BiFunction<String, String, DynamicFetchBuilderLegacy> legacyFetchResolver,
|
|
||||||
DomainResultCreationState domainResultCreationState) {
|
DomainResultCreationState domainResultCreationState) {
|
||||||
if ( argumentResultBuilders.isEmpty() ) {
|
if ( argumentResultBuilders.isEmpty() ) {
|
||||||
throw new IllegalStateException( "DynamicResultBuilderInstantiation defined no arguments" );
|
throw new IllegalStateException( "DynamicResultBuilderInstantiation defined no arguments" );
|
||||||
|
@ -119,7 +117,6 @@ public class DynamicResultBuilderInstantiation<J>
|
||||||
argument.argumentBuilder.buildResult(
|
argument.argumentBuilder.buildResult(
|
||||||
jdbcResultsMetadata,
|
jdbcResultsMetadata,
|
||||||
i,
|
i,
|
||||||
legacyFetchResolver,
|
|
||||||
domainResultCreationState
|
domainResultCreationState
|
||||||
)
|
)
|
||||||
);
|
);
|
|
@ -1,13 +1,13 @@
|
||||||
/*
|
/*
|
||||||
* Hibernate, Relational Persistence for Idiomatic Java
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
*
|
*
|
||||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later
|
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||||
* See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html
|
* See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Support for mutable result/fetch builder graphs nodes built dynamically via
|
* Support for mutable result/fetch builder graphs nodes built dynamically.
|
||||||
* Hibernate's {@link org.hibernate.query.NativeQuery} APIs
|
* Using, for example, Hibernate's {@link org.hibernate.query.NativeQuery} API.
|
||||||
*
|
*
|
||||||
* @see org.hibernate.query.NativeQuery#addScalar
|
* @see org.hibernate.query.NativeQuery#addScalar
|
||||||
* @see org.hibernate.query.NativeQuery#addEntity
|
* @see org.hibernate.query.NativeQuery#addEntity
|
||||||
|
@ -15,4 +15,4 @@
|
||||||
* @see org.hibernate.query.NativeQuery#addFetch
|
* @see org.hibernate.query.NativeQuery#addFetch
|
||||||
* @see org.hibernate.query.NativeQuery#addRoot
|
* @see org.hibernate.query.NativeQuery#addRoot
|
||||||
*/
|
*/
|
||||||
package org.hibernate.query.results.dynamic;
|
package org.hibernate.query.results.internal.dynamic;
|
|
@ -2,15 +2,12 @@
|
||||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||||
* Copyright Red Hat Inc. and Hibernate Authors
|
* Copyright Red Hat Inc. and Hibernate Authors
|
||||||
*/
|
*/
|
||||||
package org.hibernate.query.results;
|
package org.hibernate.query.results.internal.implicit;
|
||||||
|
|
||||||
import java.util.function.BiFunction;
|
|
||||||
|
|
||||||
import org.hibernate.engine.FetchTiming;
|
import org.hibernate.engine.FetchTiming;
|
||||||
import org.hibernate.metamodel.mapping.AttributeMapping;
|
import org.hibernate.metamodel.mapping.AttributeMapping;
|
||||||
|
import org.hibernate.query.results.FetchBuilder;
|
||||||
import org.hibernate.spi.NavigablePath;
|
import org.hibernate.spi.NavigablePath;
|
||||||
import org.hibernate.query.results.dynamic.DynamicFetchBuilderLegacy;
|
|
||||||
import org.hibernate.query.results.implicit.ImplicitFetchBuilder;
|
|
||||||
import org.hibernate.sql.results.graph.DomainResultCreationState;
|
import org.hibernate.sql.results.graph.DomainResultCreationState;
|
||||||
import org.hibernate.sql.results.graph.Fetch;
|
import org.hibernate.sql.results.graph.Fetch;
|
||||||
import org.hibernate.sql.results.graph.FetchParent;
|
import org.hibernate.sql.results.graph.FetchParent;
|
||||||
|
@ -40,7 +37,6 @@ public class ImplicitAttributeFetchBuilder implements FetchBuilder, ImplicitFetc
|
||||||
FetchParent parent,
|
FetchParent parent,
|
||||||
NavigablePath fetchPath,
|
NavigablePath fetchPath,
|
||||||
JdbcValuesMetadata jdbcResultsMetadata,
|
JdbcValuesMetadata jdbcResultsMetadata,
|
||||||
BiFunction<String, String, DynamicFetchBuilderLegacy> legacyFetchResolver,
|
|
||||||
DomainResultCreationState domainResultCreationState) {
|
DomainResultCreationState domainResultCreationState) {
|
||||||
assert fetchPath.equals( navigablePath );
|
assert fetchPath.equals( navigablePath );
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||||
* Copyright Red Hat Inc. and Hibernate Authors
|
* Copyright Red Hat Inc. and Hibernate Authors
|
||||||
*/
|
*/
|
||||||
package org.hibernate.query.results.implicit;
|
package org.hibernate.query.results.internal.implicit;
|
||||||
|
|
||||||
import org.hibernate.query.results.FetchBuilder;
|
import org.hibernate.query.results.FetchBuilder;
|
||||||
|
|
|
@ -2,20 +2,15 @@
|
||||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||||
* Copyright Red Hat Inc. and Hibernate Authors
|
* Copyright Red Hat Inc. and Hibernate Authors
|
||||||
*/
|
*/
|
||||||
package org.hibernate.query.results.implicit;
|
package org.hibernate.query.results.internal.implicit;
|
||||||
|
|
||||||
import java.util.function.BiConsumer;
|
|
||||||
import java.util.function.BiFunction;
|
|
||||||
import java.util.function.Function;
|
|
||||||
|
|
||||||
import org.hibernate.engine.FetchTiming;
|
import org.hibernate.engine.FetchTiming;
|
||||||
import org.hibernate.metamodel.mapping.BasicValuedModelPart;
|
import org.hibernate.metamodel.mapping.BasicValuedModelPart;
|
||||||
import org.hibernate.spi.NavigablePath;
|
|
||||||
import org.hibernate.query.results.BasicValuedFetchBuilder;
|
|
||||||
import org.hibernate.query.results.DomainResultCreationStateImpl;
|
|
||||||
import org.hibernate.query.results.FetchBuilder;
|
import org.hibernate.query.results.FetchBuilder;
|
||||||
import org.hibernate.query.results.ResultsHelper;
|
import org.hibernate.query.results.FetchBuilderBasicValued;
|
||||||
import org.hibernate.query.results.dynamic.DynamicFetchBuilderLegacy;
|
import org.hibernate.query.results.internal.DomainResultCreationStateImpl;
|
||||||
|
import org.hibernate.query.results.internal.ResultsHelper;
|
||||||
|
import org.hibernate.spi.NavigablePath;
|
||||||
import org.hibernate.sql.ast.spi.SqlSelection;
|
import org.hibernate.sql.ast.spi.SqlSelection;
|
||||||
import org.hibernate.sql.ast.tree.expression.Expression;
|
import org.hibernate.sql.ast.tree.expression.Expression;
|
||||||
import org.hibernate.sql.ast.tree.from.TableGroup;
|
import org.hibernate.sql.ast.tree.from.TableGroup;
|
||||||
|
@ -24,12 +19,15 @@ import org.hibernate.sql.results.graph.FetchParent;
|
||||||
import org.hibernate.sql.results.graph.basic.BasicFetch;
|
import org.hibernate.sql.results.graph.basic.BasicFetch;
|
||||||
import org.hibernate.sql.results.jdbc.spi.JdbcValuesMetadata;
|
import org.hibernate.sql.results.jdbc.spi.JdbcValuesMetadata;
|
||||||
|
|
||||||
import static org.hibernate.query.results.ResultsHelper.impl;
|
import java.util.function.BiConsumer;
|
||||||
|
import java.util.function.Function;
|
||||||
|
|
||||||
|
import static org.hibernate.query.results.internal.ResultsHelper.impl;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
*/
|
*/
|
||||||
public class ImplicitFetchBuilderBasic implements ImplicitFetchBuilder, BasicValuedFetchBuilder {
|
public class ImplicitFetchBuilderBasic implements ImplicitFetchBuilder, FetchBuilderBasicValued {
|
||||||
private final NavigablePath fetchPath;
|
private final NavigablePath fetchPath;
|
||||||
private final BasicValuedModelPart fetchable;
|
private final BasicValuedModelPart fetchable;
|
||||||
private final FetchBuilder fetchBuilder;
|
private final FetchBuilder fetchBuilder;
|
||||||
|
@ -61,14 +59,12 @@ public class ImplicitFetchBuilderBasic implements ImplicitFetchBuilder, BasicVal
|
||||||
FetchParent parent,
|
FetchParent parent,
|
||||||
NavigablePath fetchPath,
|
NavigablePath fetchPath,
|
||||||
JdbcValuesMetadata jdbcResultsMetadata,
|
JdbcValuesMetadata jdbcResultsMetadata,
|
||||||
BiFunction<String, String, DynamicFetchBuilderLegacy> legacyFetchResolver,
|
|
||||||
DomainResultCreationState domainResultCreationState) {
|
DomainResultCreationState domainResultCreationState) {
|
||||||
if ( fetchBuilder != null ) {
|
if ( fetchBuilder != null ) {
|
||||||
return (BasicFetch<?>) fetchBuilder.buildFetch(
|
return (BasicFetch<?>) fetchBuilder.buildFetch(
|
||||||
parent,
|
parent,
|
||||||
fetchPath,
|
fetchPath,
|
||||||
jdbcResultsMetadata,
|
jdbcResultsMetadata,
|
||||||
legacyFetchResolver,
|
|
||||||
domainResultCreationState
|
domainResultCreationState
|
||||||
);
|
);
|
||||||
}
|
}
|
|
@ -2,14 +2,12 @@
|
||||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||||
* Copyright Red Hat Inc. and Hibernate Authors
|
* Copyright Red Hat Inc. and Hibernate Authors
|
||||||
*/
|
*/
|
||||||
package org.hibernate.query.results.implicit;
|
package org.hibernate.query.results.internal.implicit;
|
||||||
|
|
||||||
import java.util.function.BiFunction;
|
|
||||||
|
|
||||||
import org.hibernate.metamodel.mapping.internal.DiscriminatedAssociationAttributeMapping;
|
import org.hibernate.metamodel.mapping.internal.DiscriminatedAssociationAttributeMapping;
|
||||||
import org.hibernate.query.results.DomainResultCreationStateImpl;
|
import org.hibernate.query.results.internal.DomainResultCreationStateImpl;
|
||||||
import org.hibernate.query.results.FetchBuilder;
|
import org.hibernate.query.results.FetchBuilder;
|
||||||
import org.hibernate.query.results.dynamic.DynamicFetchBuilderLegacy;
|
|
||||||
import org.hibernate.spi.NavigablePath;
|
import org.hibernate.spi.NavigablePath;
|
||||||
import org.hibernate.sql.ast.SqlAstJoinType;
|
import org.hibernate.sql.ast.SqlAstJoinType;
|
||||||
import org.hibernate.sql.ast.tree.from.TableGroup;
|
import org.hibernate.sql.ast.tree.from.TableGroup;
|
||||||
|
@ -19,7 +17,7 @@ import org.hibernate.sql.results.graph.Fetch;
|
||||||
import org.hibernate.sql.results.graph.FetchParent;
|
import org.hibernate.sql.results.graph.FetchParent;
|
||||||
import org.hibernate.sql.results.jdbc.spi.JdbcValuesMetadata;
|
import org.hibernate.sql.results.jdbc.spi.JdbcValuesMetadata;
|
||||||
|
|
||||||
import static org.hibernate.query.results.ResultsHelper.impl;
|
import static org.hibernate.query.results.internal.ResultsHelper.impl;
|
||||||
|
|
||||||
public class ImplicitFetchBuilderDiscriminatedAssociation implements ImplicitFetchBuilder {
|
public class ImplicitFetchBuilderDiscriminatedAssociation implements ImplicitFetchBuilder {
|
||||||
private final NavigablePath fetchPath;
|
private final NavigablePath fetchPath;
|
||||||
|
@ -43,7 +41,6 @@ public class ImplicitFetchBuilderDiscriminatedAssociation implements ImplicitFet
|
||||||
FetchParent parent,
|
FetchParent parent,
|
||||||
NavigablePath fetchPath,
|
NavigablePath fetchPath,
|
||||||
JdbcValuesMetadata jdbcResultsMetadata,
|
JdbcValuesMetadata jdbcResultsMetadata,
|
||||||
BiFunction<String, String, DynamicFetchBuilderLegacy> legacyFetchResolver,
|
|
||||||
DomainResultCreationState creationState) {
|
DomainResultCreationState creationState) {
|
||||||
final DomainResultCreationStateImpl creationStateImpl = impl( creationState );
|
final DomainResultCreationStateImpl creationStateImpl = impl( creationState );
|
||||||
|
|
|
@ -2,21 +2,13 @@
|
||||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||||
* Copyright Red Hat Inc. and Hibernate Authors
|
* Copyright Red Hat Inc. and Hibernate Authors
|
||||||
*/
|
*/
|
||||||
package org.hibernate.query.results.implicit;
|
package org.hibernate.query.results.internal.implicit;
|
||||||
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.function.BiConsumer;
|
|
||||||
import java.util.function.BiFunction;
|
|
||||||
import java.util.function.Function;
|
|
||||||
|
|
||||||
import org.hibernate.engine.FetchTiming;
|
import org.hibernate.engine.FetchTiming;
|
||||||
import org.hibernate.internal.util.collections.CollectionHelper;
|
import org.hibernate.internal.util.collections.CollectionHelper;
|
||||||
import org.hibernate.query.results.Builders;
|
import org.hibernate.query.results.internal.Builders;
|
||||||
import org.hibernate.query.results.DomainResultCreationStateImpl;
|
|
||||||
import org.hibernate.query.results.FetchBuilder;
|
import org.hibernate.query.results.FetchBuilder;
|
||||||
import org.hibernate.query.results.dynamic.DynamicFetchBuilderLegacy;
|
import org.hibernate.query.results.internal.DomainResultCreationStateImpl;
|
||||||
import org.hibernate.spi.NavigablePath;
|
import org.hibernate.spi.NavigablePath;
|
||||||
import org.hibernate.sql.ast.SqlAstJoinType;
|
import org.hibernate.sql.ast.SqlAstJoinType;
|
||||||
import org.hibernate.sql.ast.tree.from.TableGroup;
|
import org.hibernate.sql.ast.tree.from.TableGroup;
|
||||||
|
@ -28,7 +20,13 @@ import org.hibernate.sql.results.graph.Fetchable;
|
||||||
import org.hibernate.sql.results.graph.embeddable.EmbeddableValuedFetchable;
|
import org.hibernate.sql.results.graph.embeddable.EmbeddableValuedFetchable;
|
||||||
import org.hibernate.sql.results.jdbc.spi.JdbcValuesMetadata;
|
import org.hibernate.sql.results.jdbc.spi.JdbcValuesMetadata;
|
||||||
|
|
||||||
import static org.hibernate.query.results.ResultsHelper.impl;
|
import java.util.Collections;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.function.BiConsumer;
|
||||||
|
import java.util.function.Function;
|
||||||
|
|
||||||
|
import static org.hibernate.query.results.internal.ResultsHelper.impl;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
|
@ -92,11 +90,11 @@ public class ImplicitFetchBuilderEmbeddable implements ImplicitFetchBuilder {
|
||||||
FetchParent parent,
|
FetchParent parent,
|
||||||
NavigablePath fetchPath,
|
NavigablePath fetchPath,
|
||||||
JdbcValuesMetadata jdbcResultsMetadata,
|
JdbcValuesMetadata jdbcResultsMetadata,
|
||||||
BiFunction<String, String, DynamicFetchBuilderLegacy> legacyFetchResolver,
|
|
||||||
DomainResultCreationState creationState) {
|
DomainResultCreationState creationState) {
|
||||||
final DomainResultCreationStateImpl creationStateImpl = impl( creationState );
|
final DomainResultCreationStateImpl creationStateImpl = impl( creationState );
|
||||||
|
|
||||||
final TableGroup tableGroup = creationStateImpl.getFromClauseAccess().resolveTableGroup(
|
// make sure the TableGroup is available
|
||||||
|
creationStateImpl.getFromClauseAccess().resolveTableGroup(
|
||||||
fetchPath,
|
fetchPath,
|
||||||
navigablePath -> {
|
navigablePath -> {
|
||||||
final TableGroup parentTableGroup = creationStateImpl
|
final TableGroup parentTableGroup = creationStateImpl
|
||||||
|
@ -117,14 +115,6 @@ public class ImplicitFetchBuilderEmbeddable implements ImplicitFetchBuilder {
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
final Fetch fetch = parent.generateFetchableFetch(
|
|
||||||
fetchable,
|
|
||||||
fetchPath,
|
|
||||||
FetchTiming.IMMEDIATE,
|
|
||||||
true,
|
|
||||||
null,
|
|
||||||
creationState
|
|
||||||
);
|
|
||||||
// final FetchParent fetchParent = (FetchParent) fetch;
|
// final FetchParent fetchParent = (FetchParent) fetch;
|
||||||
// fetchBuilders.forEach(
|
// fetchBuilders.forEach(
|
||||||
// (subFetchPath, fetchBuilder) -> fetchBuilder.buildFetch(
|
// (subFetchPath, fetchBuilder) -> fetchBuilder.buildFetch(
|
||||||
|
@ -136,7 +126,14 @@ public class ImplicitFetchBuilderEmbeddable implements ImplicitFetchBuilder {
|
||||||
// )
|
// )
|
||||||
// );
|
// );
|
||||||
|
|
||||||
return fetch;
|
return parent.generateFetchableFetch(
|
||||||
|
fetchable,
|
||||||
|
fetchPath,
|
||||||
|
FetchTiming.IMMEDIATE,
|
||||||
|
true,
|
||||||
|
null,
|
||||||
|
creationState
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
|
@ -2,33 +2,31 @@
|
||||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||||
* Copyright Red Hat Inc. and Hibernate Authors
|
* Copyright Red Hat Inc. and Hibernate Authors
|
||||||
*/
|
*/
|
||||||
package org.hibernate.query.results.implicit;
|
package org.hibernate.query.results.internal.implicit;
|
||||||
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.function.BiConsumer;
|
|
||||||
import java.util.function.BiFunction;
|
|
||||||
import java.util.function.Function;
|
|
||||||
|
|
||||||
import org.hibernate.internal.util.StringHelper;
|
import org.hibernate.internal.util.StringHelper;
|
||||||
import org.hibernate.internal.util.collections.CollectionHelper;
|
import org.hibernate.internal.util.collections.CollectionHelper;
|
||||||
import org.hibernate.metamodel.mapping.ForeignKeyDescriptor;
|
|
||||||
import org.hibernate.metamodel.mapping.EmbeddableMappingType;
|
import org.hibernate.metamodel.mapping.EmbeddableMappingType;
|
||||||
|
import org.hibernate.metamodel.mapping.ForeignKeyDescriptor;
|
||||||
import org.hibernate.metamodel.mapping.MappingType;
|
import org.hibernate.metamodel.mapping.MappingType;
|
||||||
import org.hibernate.metamodel.mapping.internal.ToOneAttributeMapping;
|
import org.hibernate.metamodel.mapping.internal.ToOneAttributeMapping;
|
||||||
import org.hibernate.spi.NavigablePath;
|
import org.hibernate.query.results.internal.Builders;
|
||||||
import org.hibernate.query.results.Builders;
|
|
||||||
import org.hibernate.query.results.DomainResultCreationStateImpl;
|
|
||||||
import org.hibernate.query.results.FetchBuilder;
|
import org.hibernate.query.results.FetchBuilder;
|
||||||
import org.hibernate.query.results.dynamic.DynamicFetchBuilderLegacy;
|
import org.hibernate.query.results.internal.DomainResultCreationStateImpl;
|
||||||
|
import org.hibernate.spi.NavigablePath;
|
||||||
import org.hibernate.sql.results.graph.DomainResultCreationState;
|
import org.hibernate.sql.results.graph.DomainResultCreationState;
|
||||||
import org.hibernate.sql.results.graph.Fetch;
|
import org.hibernate.sql.results.graph.Fetch;
|
||||||
import org.hibernate.sql.results.graph.FetchParent;
|
import org.hibernate.sql.results.graph.FetchParent;
|
||||||
import org.hibernate.sql.results.graph.Fetchable;
|
import org.hibernate.sql.results.graph.Fetchable;
|
||||||
import org.hibernate.sql.results.jdbc.spi.JdbcValuesMetadata;
|
import org.hibernate.sql.results.jdbc.spi.JdbcValuesMetadata;
|
||||||
|
|
||||||
import static org.hibernate.query.results.ResultsHelper.impl;
|
import java.util.Collections;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.function.BiConsumer;
|
||||||
|
import java.util.function.Function;
|
||||||
|
|
||||||
|
import static org.hibernate.query.results.internal.ResultsHelper.impl;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
|
@ -67,8 +65,7 @@ public class ImplicitFetchBuilderEntity implements ImplicitFetchBuilder {
|
||||||
final Map<NavigablePath, FetchBuilder> fetchBuilders;
|
final Map<NavigablePath, FetchBuilder> fetchBuilders;
|
||||||
if ( explicitAssociationKeyFetchBuilder == null ) {
|
if ( explicitAssociationKeyFetchBuilder == null ) {
|
||||||
final MappingType partMappingType = foreignKeyDescriptor.getPartMappingType();
|
final MappingType partMappingType = foreignKeyDescriptor.getPartMappingType();
|
||||||
if ( partMappingType instanceof EmbeddableMappingType ) {
|
if ( partMappingType instanceof EmbeddableMappingType embeddableValuedModelPart ) {
|
||||||
final EmbeddableMappingType embeddableValuedModelPart = (EmbeddableMappingType) partMappingType;
|
|
||||||
final int size = embeddableValuedModelPart.getNumberOfFetchables();
|
final int size = embeddableValuedModelPart.getNumberOfFetchables();
|
||||||
fetchBuilders = CollectionHelper.linkedMapOfSize( size );
|
fetchBuilders = CollectionHelper.linkedMapOfSize( size );
|
||||||
for ( int i = 0; i < size; i++ ) {
|
for ( int i = 0; i < size; i++ ) {
|
||||||
|
@ -122,9 +119,8 @@ public class ImplicitFetchBuilderEntity implements ImplicitFetchBuilder {
|
||||||
FetchParent parent,
|
FetchParent parent,
|
||||||
NavigablePath fetchPath,
|
NavigablePath fetchPath,
|
||||||
JdbcValuesMetadata jdbcResultsMetadata,
|
JdbcValuesMetadata jdbcResultsMetadata,
|
||||||
BiFunction<String, String, DynamicFetchBuilderLegacy> legacyFetchResolver,
|
|
||||||
DomainResultCreationState creationState) {
|
DomainResultCreationState creationState) {
|
||||||
final Fetch fetch = parent.generateFetchableFetch(
|
return parent.generateFetchableFetch(
|
||||||
fetchable,
|
fetchable,
|
||||||
fetchPath,
|
fetchPath,
|
||||||
fetchable.getMappedFetchOptions().getTiming(),
|
fetchable.getMappedFetchOptions().getTiming(),
|
||||||
|
@ -132,18 +128,6 @@ public class ImplicitFetchBuilderEntity implements ImplicitFetchBuilder {
|
||||||
null,
|
null,
|
||||||
creationState
|
creationState
|
||||||
);
|
);
|
||||||
// final FetchParent fetchParent = (FetchParent) fetch;
|
|
||||||
// fetchBuilders.forEach(
|
|
||||||
// (subFetchPath, fetchBuilder) -> fetchBuilder.buildFetch(
|
|
||||||
// fetchParent,
|
|
||||||
// subFetchPath,
|
|
||||||
// jdbcResultsMetadata,
|
|
||||||
// legacyFetchResolver,
|
|
||||||
// creationState
|
|
||||||
// )
|
|
||||||
// );
|
|
||||||
|
|
||||||
return fetch;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
|
@ -2,15 +2,13 @@
|
||||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||||
* Copyright Red Hat Inc. and Hibernate Authors
|
* Copyright Red Hat Inc. and Hibernate Authors
|
||||||
*/
|
*/
|
||||||
package org.hibernate.query.results.implicit;
|
package org.hibernate.query.results.internal.implicit;
|
||||||
|
|
||||||
import java.util.function.BiFunction;
|
|
||||||
|
|
||||||
import org.hibernate.engine.FetchTiming;
|
import org.hibernate.engine.FetchTiming;
|
||||||
import org.hibernate.metamodel.mapping.internal.EntityCollectionPart;
|
import org.hibernate.metamodel.mapping.internal.EntityCollectionPart;
|
||||||
import org.hibernate.spi.NavigablePath;
|
import org.hibernate.spi.NavigablePath;
|
||||||
import org.hibernate.query.results.FetchBuilder;
|
import org.hibernate.query.results.FetchBuilder;
|
||||||
import org.hibernate.query.results.dynamic.DynamicFetchBuilderLegacy;
|
|
||||||
import org.hibernate.sql.results.graph.DomainResultCreationState;
|
import org.hibernate.sql.results.graph.DomainResultCreationState;
|
||||||
import org.hibernate.sql.results.graph.Fetch;
|
import org.hibernate.sql.results.graph.Fetch;
|
||||||
import org.hibernate.sql.results.graph.FetchParent;
|
import org.hibernate.sql.results.graph.FetchParent;
|
||||||
|
@ -38,7 +36,6 @@ public class ImplicitFetchBuilderEntityPart implements ImplicitFetchBuilder {
|
||||||
FetchParent parent,
|
FetchParent parent,
|
||||||
NavigablePath fetchPath,
|
NavigablePath fetchPath,
|
||||||
JdbcValuesMetadata jdbcResultsMetadata,
|
JdbcValuesMetadata jdbcResultsMetadata,
|
||||||
BiFunction<String, String, DynamicFetchBuilderLegacy> legacyFetchResolver,
|
|
||||||
DomainResultCreationState creationState) {
|
DomainResultCreationState creationState) {
|
||||||
return parent.generateFetchableFetch(
|
return parent.generateFetchableFetch(
|
||||||
fetchable,
|
fetchable,
|
|
@ -2,14 +2,12 @@
|
||||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||||
* Copyright Red Hat Inc. and Hibernate Authors
|
* Copyright Red Hat Inc. and Hibernate Authors
|
||||||
*/
|
*/
|
||||||
package org.hibernate.query.results.implicit;
|
package org.hibernate.query.results.internal.implicit;
|
||||||
|
|
||||||
import java.util.function.BiFunction;
|
|
||||||
|
|
||||||
import org.hibernate.metamodel.mapping.PluralAttributeMapping;
|
import org.hibernate.metamodel.mapping.PluralAttributeMapping;
|
||||||
import org.hibernate.spi.NavigablePath;
|
import org.hibernate.spi.NavigablePath;
|
||||||
import org.hibernate.query.results.FetchBuilder;
|
import org.hibernate.query.results.FetchBuilder;
|
||||||
import org.hibernate.query.results.dynamic.DynamicFetchBuilderLegacy;
|
|
||||||
import org.hibernate.sql.results.graph.DomainResultCreationState;
|
import org.hibernate.sql.results.graph.DomainResultCreationState;
|
||||||
import org.hibernate.sql.results.graph.Fetch;
|
import org.hibernate.sql.results.graph.Fetch;
|
||||||
import org.hibernate.sql.results.graph.FetchParent;
|
import org.hibernate.sql.results.graph.FetchParent;
|
||||||
|
@ -41,7 +39,6 @@ public class ImplicitFetchBuilderPlural implements ImplicitFetchBuilder {
|
||||||
FetchParent parent,
|
FetchParent parent,
|
||||||
NavigablePath fetchPath,
|
NavigablePath fetchPath,
|
||||||
JdbcValuesMetadata jdbcResultsMetadata,
|
JdbcValuesMetadata jdbcResultsMetadata,
|
||||||
BiFunction<String, String, DynamicFetchBuilderLegacy> legacyFetchResolver,
|
|
||||||
DomainResultCreationState creationState) {
|
DomainResultCreationState creationState) {
|
||||||
|
|
||||||
final Fetch fetch = parent.generateFetchableFetch(
|
final Fetch fetch = parent.generateFetchableFetch(
|
|
@ -2,7 +2,7 @@
|
||||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||||
* Copyright Red Hat Inc. and Hibernate Authors
|
* Copyright Red Hat Inc. and Hibernate Authors
|
||||||
*/
|
*/
|
||||||
package org.hibernate.query.results.implicit;
|
package org.hibernate.query.results.internal.implicit;
|
||||||
|
|
||||||
import org.hibernate.query.results.ResultBuilder;
|
import org.hibernate.query.results.ResultBuilder;
|
||||||
|
|
|
@ -2,17 +2,14 @@
|
||||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||||
* Copyright Red Hat Inc. and Hibernate Authors
|
* Copyright Red Hat Inc. and Hibernate Authors
|
||||||
*/
|
*/
|
||||||
package org.hibernate.query.results.implicit;
|
package org.hibernate.query.results.internal.implicit;
|
||||||
|
|
||||||
import java.util.function.BiFunction;
|
|
||||||
|
|
||||||
import org.hibernate.metamodel.mapping.BasicValuedModelPart;
|
import org.hibernate.metamodel.mapping.BasicValuedModelPart;
|
||||||
import org.hibernate.spi.NavigablePath;
|
|
||||||
import org.hibernate.query.results.DomainResultCreationStateImpl;
|
|
||||||
import org.hibernate.query.results.ResultBuilder;
|
import org.hibernate.query.results.ResultBuilder;
|
||||||
import org.hibernate.query.results.ResultBuilderBasicValued;
|
import org.hibernate.query.results.ResultBuilderBasicValued;
|
||||||
import org.hibernate.query.results.ResultsHelper;
|
import org.hibernate.query.results.internal.DomainResultCreationStateImpl;
|
||||||
import org.hibernate.query.results.dynamic.DynamicFetchBuilderLegacy;
|
import org.hibernate.query.results.internal.ResultsHelper;
|
||||||
|
import org.hibernate.spi.NavigablePath;
|
||||||
import org.hibernate.sql.ast.tree.from.TableGroup;
|
import org.hibernate.sql.ast.tree.from.TableGroup;
|
||||||
import org.hibernate.sql.results.graph.DomainResultCreationState;
|
import org.hibernate.sql.results.graph.DomainResultCreationState;
|
||||||
import org.hibernate.sql.results.graph.basic.BasicResult;
|
import org.hibernate.sql.results.graph.basic.BasicResult;
|
||||||
|
@ -45,7 +42,6 @@ public class ImplicitModelPartResultBuilderBasic
|
||||||
public BasicResult<?> buildResult(
|
public BasicResult<?> buildResult(
|
||||||
JdbcValuesMetadata jdbcResultsMetadata,
|
JdbcValuesMetadata jdbcResultsMetadata,
|
||||||
int resultPosition,
|
int resultPosition,
|
||||||
BiFunction<String, String, DynamicFetchBuilderLegacy> legacyFetchResolver,
|
|
||||||
DomainResultCreationState domainResultCreationState) {
|
DomainResultCreationState domainResultCreationState) {
|
||||||
final DomainResultCreationStateImpl creationStateImpl = ResultsHelper.impl( domainResultCreationState );
|
final DomainResultCreationStateImpl creationStateImpl = ResultsHelper.impl( domainResultCreationState );
|
||||||
|
|
|
@ -2,17 +2,14 @@
|
||||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||||
* Copyright Red Hat Inc. and Hibernate Authors
|
* Copyright Red Hat Inc. and Hibernate Authors
|
||||||
*/
|
*/
|
||||||
package org.hibernate.query.results.implicit;
|
package org.hibernate.query.results.internal.implicit;
|
||||||
|
|
||||||
import java.util.function.BiFunction;
|
|
||||||
|
|
||||||
import org.hibernate.metamodel.mapping.EmbeddableValuedModelPart;
|
import org.hibernate.metamodel.mapping.EmbeddableValuedModelPart;
|
||||||
import org.hibernate.spi.NavigablePath;
|
|
||||||
import org.hibernate.query.results.DomainResultCreationStateImpl;
|
|
||||||
import org.hibernate.query.results.ResultBuilder;
|
import org.hibernate.query.results.ResultBuilder;
|
||||||
import org.hibernate.query.results.ResultBuilderEmbeddable;
|
import org.hibernate.query.results.ResultBuilderEmbeddable;
|
||||||
import org.hibernate.query.results.ResultsHelper;
|
import org.hibernate.query.results.internal.DomainResultCreationStateImpl;
|
||||||
import org.hibernate.query.results.dynamic.DynamicFetchBuilderLegacy;
|
import org.hibernate.query.results.internal.ResultsHelper;
|
||||||
|
import org.hibernate.spi.NavigablePath;
|
||||||
import org.hibernate.sql.ast.SqlAstJoinType;
|
import org.hibernate.sql.ast.SqlAstJoinType;
|
||||||
import org.hibernate.sql.ast.tree.from.TableGroup;
|
import org.hibernate.sql.ast.tree.from.TableGroup;
|
||||||
import org.hibernate.sql.ast.tree.from.TableGroupJoin;
|
import org.hibernate.sql.ast.tree.from.TableGroupJoin;
|
||||||
|
@ -47,10 +44,9 @@ public class ImplicitModelPartResultBuilderEmbeddable
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EmbeddableResult buildResult(
|
public EmbeddableResult<?> buildResult(
|
||||||
JdbcValuesMetadata jdbcResultsMetadata,
|
JdbcValuesMetadata jdbcResultsMetadata,
|
||||||
int resultPosition,
|
int resultPosition,
|
||||||
BiFunction<String, String, DynamicFetchBuilderLegacy> legacyFetchResolver,
|
|
||||||
DomainResultCreationState domainResultCreationState) {
|
DomainResultCreationState domainResultCreationState) {
|
||||||
final DomainResultCreationStateImpl creationStateImpl = ResultsHelper.impl( domainResultCreationState );
|
final DomainResultCreationStateImpl creationStateImpl = ResultsHelper.impl( domainResultCreationState );
|
||||||
creationStateImpl.disallowPositionalSelections();
|
creationStateImpl.disallowPositionalSelections();
|
||||||
|
@ -85,7 +81,7 @@ public class ImplicitModelPartResultBuilderEmbeddable
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
return (EmbeddableResult) modelPart.createDomainResult(
|
return (EmbeddableResult<?>) modelPart.createDomainResult(
|
||||||
navigablePath,
|
navigablePath,
|
||||||
tableGroup,
|
tableGroup,
|
||||||
null,
|
null,
|
|
@ -2,18 +2,15 @@
|
||||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||||
* Copyright Red Hat Inc. and Hibernate Authors
|
* Copyright Red Hat Inc. and Hibernate Authors
|
||||||
*/
|
*/
|
||||||
package org.hibernate.query.results.implicit;
|
package org.hibernate.query.results.internal.implicit;
|
||||||
|
|
||||||
import java.util.function.BiFunction;
|
|
||||||
|
|
||||||
import org.hibernate.metamodel.mapping.EntityMappingType;
|
import org.hibernate.metamodel.mapping.EntityMappingType;
|
||||||
import org.hibernate.metamodel.mapping.EntityValuedModelPart;
|
import org.hibernate.metamodel.mapping.EntityValuedModelPart;
|
||||||
import org.hibernate.spi.NavigablePath;
|
|
||||||
import org.hibernate.query.results.DomainResultCreationStateImpl;
|
|
||||||
import org.hibernate.query.results.ResultBuilder;
|
import org.hibernate.query.results.ResultBuilder;
|
||||||
import org.hibernate.query.results.ResultBuilderEntityValued;
|
import org.hibernate.query.results.ResultBuilderEntityValued;
|
||||||
import org.hibernate.query.results.ResultsHelper;
|
import org.hibernate.query.results.internal.DomainResultCreationStateImpl;
|
||||||
import org.hibernate.query.results.dynamic.DynamicFetchBuilderLegacy;
|
import org.hibernate.query.results.internal.ResultsHelper;
|
||||||
|
import org.hibernate.spi.NavigablePath;
|
||||||
import org.hibernate.sql.ast.tree.from.TableGroup;
|
import org.hibernate.sql.ast.tree.from.TableGroup;
|
||||||
import org.hibernate.sql.results.graph.DomainResultCreationState;
|
import org.hibernate.sql.results.graph.DomainResultCreationState;
|
||||||
import org.hibernate.sql.results.graph.entity.EntityResult;
|
import org.hibernate.sql.results.graph.entity.EntityResult;
|
||||||
|
@ -53,7 +50,6 @@ public class ImplicitModelPartResultBuilderEntity
|
||||||
public EntityResult buildResult(
|
public EntityResult buildResult(
|
||||||
JdbcValuesMetadata jdbcResultsMetadata,
|
JdbcValuesMetadata jdbcResultsMetadata,
|
||||||
int resultPosition,
|
int resultPosition,
|
||||||
BiFunction<String, String, DynamicFetchBuilderLegacy> legacyFetchResolver,
|
|
||||||
DomainResultCreationState domainResultCreationState) {
|
DomainResultCreationState domainResultCreationState) {
|
||||||
final DomainResultCreationStateImpl creationStateImpl = ResultsHelper.impl( domainResultCreationState );
|
final DomainResultCreationStateImpl creationStateImpl = ResultsHelper.impl( domainResultCreationState );
|
||||||
creationStateImpl.disallowPositionalSelections();
|
creationStateImpl.disallowPositionalSelections();
|
|
@ -2,15 +2,13 @@
|
||||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||||
* Copyright Red Hat Inc. and Hibernate Authors
|
* Copyright Red Hat Inc. and Hibernate Authors
|
||||||
*/
|
*/
|
||||||
package org.hibernate.query.results.implicit;
|
package org.hibernate.query.results.internal.implicit;
|
||||||
|
|
||||||
import java.util.function.BiFunction;
|
|
||||||
|
|
||||||
|
import jakarta.persistence.NamedNativeQuery;
|
||||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
import org.hibernate.metamodel.mapping.BasicValuedMapping;
|
import org.hibernate.metamodel.mapping.BasicValuedMapping;
|
||||||
import org.hibernate.query.results.ResultBuilder;
|
import org.hibernate.query.results.ResultBuilder;
|
||||||
import org.hibernate.query.results.ResultSetMappingSqlSelection;
|
import org.hibernate.query.results.internal.ResultSetMappingSqlSelection;
|
||||||
import org.hibernate.query.results.dynamic.DynamicFetchBuilderLegacy;
|
|
||||||
import org.hibernate.sql.ast.spi.SqlExpressionResolver;
|
import org.hibernate.sql.ast.spi.SqlExpressionResolver;
|
||||||
import org.hibernate.sql.ast.spi.SqlSelection;
|
import org.hibernate.sql.ast.spi.SqlSelection;
|
||||||
import org.hibernate.sql.results.graph.DomainResult;
|
import org.hibernate.sql.results.graph.DomainResult;
|
||||||
|
@ -20,8 +18,6 @@ import org.hibernate.sql.results.jdbc.spi.JdbcValuesMetadata;
|
||||||
import org.hibernate.type.BasicType;
|
import org.hibernate.type.BasicType;
|
||||||
import org.hibernate.type.spi.TypeConfiguration;
|
import org.hibernate.type.spi.TypeConfiguration;
|
||||||
|
|
||||||
import jakarta.persistence.NamedNativeQuery;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ResultBuilder for handling {@link NamedNativeQuery#resultClass()} when the
|
* ResultBuilder for handling {@link NamedNativeQuery#resultClass()} when the
|
||||||
* class does not refer to an entity
|
* class does not refer to an entity
|
||||||
|
@ -39,7 +35,6 @@ public class ImplicitResultClassBuilder implements ResultBuilder {
|
||||||
public DomainResult<?> buildResult(
|
public DomainResult<?> buildResult(
|
||||||
JdbcValuesMetadata jdbcResultsMetadata,
|
JdbcValuesMetadata jdbcResultsMetadata,
|
||||||
int resultPosition,
|
int resultPosition,
|
||||||
BiFunction<String, String, DynamicFetchBuilderLegacy> legacyFetchResolver,
|
|
||||||
DomainResultCreationState domainResultCreationState) {
|
DomainResultCreationState domainResultCreationState) {
|
||||||
assert resultPosition == 0;
|
assert resultPosition == 0;
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
/*
|
/*
|
||||||
* Hibernate, Relational Persistence for Idiomatic Java
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
*
|
*
|
||||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later
|
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||||
* See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html
|
* See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -12,4 +12,4 @@
|
||||||
* <li>mapping results to a named entity class with no explicit property mappings</li>
|
* <li>mapping results to a named entity class with no explicit property mappings</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
*/
|
*/
|
||||||
package org.hibernate.query.results.implicit;
|
package org.hibernate.query.results.internal.implicit;
|
|
@ -6,20 +6,10 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Support for defining result set mappings used in {@link org.hibernate.query.NativeQuery},
|
* Support for defining {@linkplain org.hibernate.query.results.ResultSetMapping result set mappings}
|
||||||
* {@link org.hibernate.procedure.ProcedureCall}, and {@link jakarta.persistence.StoredProcedureQuery}.
|
* used in {@link org.hibernate.query.NativeQuery}, {@link org.hibernate.procedure.ProcedureCall},
|
||||||
* These result set mappings are used to map the values in the JDBC {@link java.sql.ResultSet} into
|
* and {@link jakarta.persistence.StoredProcedureQuery}. These result set mappings are used to map
|
||||||
* the query result graph.
|
* the values in the JDBC {@link java.sql.ResultSet} into the query result graph.
|
||||||
* <p>
|
|
||||||
* Subpackages handle different sources of result set mappings:
|
|
||||||
* <ul>
|
|
||||||
* <li>{@link org.hibernate.query.results.complete} handles result set mappings which are completely
|
|
||||||
* known upfront and are faster to resolve.
|
|
||||||
* <li>{@link org.hibernate.query.results.dynamic} handles result set mappings which are defined
|
|
||||||
* incrementally via the {@link org.hibernate.query.NativeQuery} interface and need to resolve
|
|
||||||
* themselves against other dynamic mappings. These take more resources to resolve.
|
|
||||||
* <li>{@link org.hibernate.query.results.implicit} handles implicit result set mappings.
|
|
||||||
* </ul>
|
|
||||||
*
|
*
|
||||||
* @see org.hibernate.query.results.ResultSetMapping
|
* @see org.hibernate.query.results.ResultSetMapping
|
||||||
*
|
*
|
||||||
|
|
|
@ -53,17 +53,17 @@ import org.hibernate.query.internal.QueryOptionsImpl;
|
||||||
import org.hibernate.query.internal.ResultSetMappingResolutionContext;
|
import org.hibernate.query.internal.ResultSetMappingResolutionContext;
|
||||||
import org.hibernate.query.named.NamedObjectRepository;
|
import org.hibernate.query.named.NamedObjectRepository;
|
||||||
import org.hibernate.query.named.NamedResultSetMappingMemento;
|
import org.hibernate.query.named.NamedResultSetMappingMemento;
|
||||||
import org.hibernate.query.results.Builders;
|
import org.hibernate.query.results.internal.Builders;
|
||||||
import org.hibernate.query.results.ResultBuilder;
|
import org.hibernate.query.results.ResultBuilder;
|
||||||
import org.hibernate.query.results.ResultSetMapping;
|
import org.hibernate.query.results.ResultSetMapping;
|
||||||
import org.hibernate.query.results.ResultSetMappingImpl;
|
import org.hibernate.query.results.internal.ResultSetMappingImpl;
|
||||||
import org.hibernate.query.results.dynamic.DynamicFetchBuilderLegacy;
|
import org.hibernate.query.results.internal.dynamic.DynamicFetchBuilderLegacy;
|
||||||
import org.hibernate.query.results.dynamic.DynamicResultBuilderBasicStandard;
|
import org.hibernate.query.results.internal.dynamic.DynamicResultBuilderBasicStandard;
|
||||||
import org.hibernate.query.results.dynamic.DynamicResultBuilderEntityCalculated;
|
import org.hibernate.query.results.internal.dynamic.DynamicResultBuilderEntityCalculated;
|
||||||
import org.hibernate.query.results.dynamic.DynamicResultBuilderEntityStandard;
|
import org.hibernate.query.results.internal.dynamic.DynamicResultBuilderEntityStandard;
|
||||||
import org.hibernate.query.results.dynamic.DynamicResultBuilderInstantiation;
|
import org.hibernate.query.results.internal.dynamic.DynamicResultBuilderInstantiation;
|
||||||
import org.hibernate.query.results.implicit.ImplicitModelPartResultBuilderEntity;
|
import org.hibernate.query.results.internal.implicit.ImplicitModelPartResultBuilderEntity;
|
||||||
import org.hibernate.query.results.implicit.ImplicitResultClassBuilder;
|
import org.hibernate.query.results.internal.implicit.ImplicitResultClassBuilder;
|
||||||
import org.hibernate.query.spi.AbstractQuery;
|
import org.hibernate.query.spi.AbstractQuery;
|
||||||
import org.hibernate.query.spi.DomainQueryExecutionContext;
|
import org.hibernate.query.spi.DomainQueryExecutionContext;
|
||||||
import org.hibernate.query.spi.MutableQueryOptions;
|
import org.hibernate.query.spi.MutableQueryOptions;
|
||||||
|
@ -114,7 +114,7 @@ import static org.hibernate.internal.util.collections.CollectionHelper.isEmpty;
|
||||||
import static org.hibernate.internal.util.collections.CollectionHelper.isNotEmpty;
|
import static org.hibernate.internal.util.collections.CollectionHelper.isNotEmpty;
|
||||||
import static org.hibernate.internal.util.collections.CollectionHelper.makeCopy;
|
import static org.hibernate.internal.util.collections.CollectionHelper.makeCopy;
|
||||||
import static org.hibernate.jpa.HibernateHints.HINT_NATIVE_LOCK_MODE;
|
import static org.hibernate.jpa.HibernateHints.HINT_NATIVE_LOCK_MODE;
|
||||||
import static org.hibernate.query.results.Builders.resultClassBuilder;
|
import static org.hibernate.query.results.internal.Builders.resultClassBuilder;
|
||||||
import static org.hibernate.query.results.ResultSetMapping.resolveResultSetMapping;
|
import static org.hibernate.query.results.ResultSetMapping.resolveResultSetMapping;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -28,11 +28,12 @@ import org.hibernate.persister.collection.CollectionPersister;
|
||||||
import org.hibernate.persister.entity.EntityPersister;
|
import org.hibernate.persister.entity.EntityPersister;
|
||||||
import org.hibernate.query.NativeQuery;
|
import org.hibernate.query.NativeQuery;
|
||||||
import org.hibernate.query.results.FetchBuilder;
|
import org.hibernate.query.results.FetchBuilder;
|
||||||
|
import org.hibernate.query.results.LegacyFetchBuilder;
|
||||||
import org.hibernate.query.results.ResultSetMapping;
|
import org.hibernate.query.results.ResultSetMapping;
|
||||||
import org.hibernate.query.results.complete.CompleteResultBuilderCollectionStandard;
|
import org.hibernate.query.results.internal.complete.CompleteResultBuilderCollectionStandard;
|
||||||
import org.hibernate.query.results.dynamic.DynamicFetchBuilderContainer;
|
import org.hibernate.query.results.internal.dynamic.DynamicFetchBuilderContainer;
|
||||||
import org.hibernate.query.results.dynamic.DynamicFetchBuilderLegacy;
|
import org.hibernate.query.results.internal.dynamic.DynamicFetchBuilderLegacy;
|
||||||
import org.hibernate.query.results.dynamic.DynamicResultBuilderEntityStandard;
|
import org.hibernate.query.results.internal.dynamic.DynamicResultBuilderEntityStandard;
|
||||||
import org.hibernate.spi.NavigablePath;
|
import org.hibernate.spi.NavigablePath;
|
||||||
import org.hibernate.type.CollectionType;
|
import org.hibernate.type.CollectionType;
|
||||||
import org.hibernate.type.ComponentType;
|
import org.hibernate.type.ComponentType;
|
||||||
|
@ -102,13 +103,11 @@ public class ResultSetMappingProcessor implements SQLQueryParser.ParserContext {
|
||||||
// so that role returns can be more easily resolved to their owners
|
// so that role returns can be more easily resolved to their owners
|
||||||
resultSetMapping.visitResultBuilders(
|
resultSetMapping.visitResultBuilders(
|
||||||
(i, resultBuilder) -> {
|
(i, resultBuilder) -> {
|
||||||
if ( resultBuilder instanceof NativeQuery.RootReturn ) {
|
if ( resultBuilder instanceof NativeQuery.RootReturn rootReturn ) {
|
||||||
final NativeQuery.RootReturn rootReturn = (NativeQuery.RootReturn) resultBuilder;
|
|
||||||
alias2Return.put( rootReturn.getTableAlias(), rootReturn );
|
alias2Return.put( rootReturn.getTableAlias(), rootReturn );
|
||||||
resultBuilder.visitFetchBuilders( this::processFetchBuilder );
|
resultBuilder.visitFetchBuilders( this::processFetchBuilder );
|
||||||
}
|
}
|
||||||
else if ( resultBuilder instanceof NativeQuery.CollectionReturn ) {
|
else if ( resultBuilder instanceof NativeQuery.CollectionReturn collectionReturn ) {
|
||||||
final NativeQuery.CollectionReturn collectionReturn = (NativeQuery.CollectionReturn) resultBuilder;
|
|
||||||
alias2Return.put( collectionReturn.getTableAlias(), collectionReturn );
|
alias2Return.put( collectionReturn.getTableAlias(), collectionReturn );
|
||||||
Map<String, String[]> propertyResultsMap = Collections.emptyMap();//fetchReturn.getPropertyResultsMap()
|
Map<String, String[]> propertyResultsMap = Collections.emptyMap();//fetchReturn.getPropertyResultsMap()
|
||||||
addCollection(
|
addCollection(
|
||||||
|
@ -119,12 +118,12 @@ public class ResultSetMappingProcessor implements SQLQueryParser.ParserContext {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
resultSetMapping.visitLegacyFetchBuilders(
|
|
||||||
fetchBuilder -> {
|
// handle fetches defined using {@code hbm.xml} or NativeQuery apis
|
||||||
alias2Return.put( fetchBuilder.getTableAlias(), fetchBuilder );
|
resultSetMapping.visitLegacyFetchBuilders( (fetchBuilder) -> {
|
||||||
|
alias2Return.put( fetchBuilder.getTableAlias(), (NativeQuery.ReturnableResultNode) fetchBuilder );
|
||||||
alias2OwnerAlias.put( fetchBuilder.getTableAlias(), fetchBuilder.getOwnerAlias() );
|
alias2OwnerAlias.put( fetchBuilder.getTableAlias(), fetchBuilder.getOwnerAlias() );
|
||||||
}
|
} );
|
||||||
);
|
|
||||||
|
|
||||||
// Now, process the returns
|
// Now, process the returns
|
||||||
for ( NativeQuery.ResultNode queryReturn : alias2Return.values() ) {
|
for ( NativeQuery.ResultNode queryReturn : alias2Return.values() ) {
|
||||||
|
@ -135,11 +134,10 @@ public class ResultSetMappingProcessor implements SQLQueryParser.ParserContext {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void processFetchBuilder(String attributeName, FetchBuilder fetchBuilder) {
|
private void processFetchBuilder(String attributeName, FetchBuilder fetchBuilder) {
|
||||||
if ( fetchBuilder instanceof DynamicFetchBuilderLegacy ) {
|
if ( fetchBuilder instanceof LegacyFetchBuilder ) {
|
||||||
resultSetMapping.addLegacyFetchBuilder( (DynamicFetchBuilderLegacy) fetchBuilder );
|
resultSetMapping.addLegacyFetchBuilder( (LegacyFetchBuilder) fetchBuilder );
|
||||||
}
|
}
|
||||||
else if ( fetchBuilder instanceof NativeQuery.FetchReturn ) {
|
else if ( fetchBuilder instanceof NativeQuery.FetchReturn fetchReturn ) {
|
||||||
final NativeQuery.FetchReturn fetchReturn = (NativeQuery.FetchReturn) fetchBuilder;
|
|
||||||
alias2Return.put( fetchReturn.getTableAlias(), fetchReturn );
|
alias2Return.put( fetchReturn.getTableAlias(), fetchReturn );
|
||||||
alias2OwnerAlias.put( fetchReturn.getTableAlias(), fetchReturn.getOwnerAlias() );
|
alias2OwnerAlias.put( fetchReturn.getTableAlias(), fetchReturn.getOwnerAlias() );
|
||||||
}
|
}
|
||||||
|
@ -155,8 +153,7 @@ public class ResultSetMappingProcessor implements SQLQueryParser.ParserContext {
|
||||||
final Set<String> visited = new HashSet<>();
|
final Set<String> visited = new HashSet<>();
|
||||||
this.resultSetMapping.visitResultBuilders(
|
this.resultSetMapping.visitResultBuilders(
|
||||||
(i, resultBuilder) -> {
|
(i, resultBuilder) -> {
|
||||||
if ( resultBuilder instanceof NativeQuery.RootReturn ) {
|
if ( resultBuilder instanceof NativeQuery.RootReturn rootReturn ) {
|
||||||
final NativeQuery.RootReturn rootReturn = (NativeQuery.RootReturn) resultBuilder;
|
|
||||||
final String suffix = alias2Suffix.get( rootReturn.getTableAlias() );
|
final String suffix = alias2Suffix.get( rootReturn.getTableAlias() );
|
||||||
visited.add( rootReturn.getTableAlias() );
|
visited.add( rootReturn.getTableAlias() );
|
||||||
if ( suffix == null ) {
|
if ( suffix == null ) {
|
||||||
|
@ -172,8 +169,7 @@ public class ResultSetMappingProcessor implements SQLQueryParser.ParserContext {
|
||||||
alias2Return.put( rootReturn.getTableAlias(), resultBuilderEntity );
|
alias2Return.put( rootReturn.getTableAlias(), resultBuilderEntity );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ( resultBuilder instanceof NativeQuery.CollectionReturn ) {
|
else if ( resultBuilder instanceof NativeQuery.CollectionReturn collectionReturn ) {
|
||||||
final NativeQuery.CollectionReturn collectionReturn = (NativeQuery.CollectionReturn) resultBuilder;
|
|
||||||
final String suffix = alias2CollectionSuffix.get( collectionReturn.getTableAlias() );
|
final String suffix = alias2CollectionSuffix.get( collectionReturn.getTableAlias() );
|
||||||
if ( suffix == null ) {
|
if ( suffix == null ) {
|
||||||
resultSetMapping.addResultBuilder( resultBuilder );
|
resultSetMapping.addResultBuilder( resultBuilder );
|
||||||
|
@ -202,7 +198,7 @@ public class ResultSetMappingProcessor implements SQLQueryParser.ParserContext {
|
||||||
|
|
||||||
private void applyFetchBuilder(
|
private void applyFetchBuilder(
|
||||||
ResultSetMapping resultSetMapping,
|
ResultSetMapping resultSetMapping,
|
||||||
DynamicFetchBuilderLegacy fetchBuilder,
|
LegacyFetchBuilder fetchBuilder,
|
||||||
Set<String> visited) {
|
Set<String> visited) {
|
||||||
if ( !visited.add( fetchBuilder.getTableAlias() ) ) {
|
if ( !visited.add( fetchBuilder.getTableAlias() ) ) {
|
||||||
return;
|
return;
|
||||||
|
@ -273,7 +269,7 @@ public class ResultSetMappingProcessor implements SQLQueryParser.ParserContext {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private NavigablePath determineNavigablePath(DynamicFetchBuilderLegacy fetchBuilder) {
|
private NavigablePath determineNavigablePath(LegacyFetchBuilder fetchBuilder) {
|
||||||
final NativeQuery.ResultNode ownerResult = alias2Return.get( fetchBuilder.getOwnerAlias() );
|
final NativeQuery.ResultNode ownerResult = alias2Return.get( fetchBuilder.getOwnerAlias() );
|
||||||
if ( ownerResult instanceof NativeQuery.RootReturn ) {
|
if ( ownerResult instanceof NativeQuery.RootReturn ) {
|
||||||
return ( (NativeQuery.RootReturn) ownerResult ).getNavigablePath()
|
return ( (NativeQuery.RootReturn) ownerResult ).getNavigablePath()
|
||||||
|
@ -349,8 +345,7 @@ public class ResultSetMappingProcessor implements SQLQueryParser.ParserContext {
|
||||||
String propertyName,
|
String propertyName,
|
||||||
String[] columnAliases,
|
String[] columnAliases,
|
||||||
Type propertyType) {
|
Type propertyType) {
|
||||||
if ( propertyType instanceof CollectionType ) {
|
if ( propertyType instanceof CollectionType collectionType ) {
|
||||||
final CollectionType collectionType = (CollectionType) propertyType;
|
|
||||||
final String[] keyColumnAliases;
|
final String[] keyColumnAliases;
|
||||||
if ( collectionType.useLHSPrimaryKey() ) {
|
if ( collectionType.useLHSPrimaryKey() ) {
|
||||||
keyColumnAliases = identifierAliases;
|
keyColumnAliases = identifierAliases;
|
||||||
|
@ -363,7 +358,7 @@ public class ResultSetMappingProcessor implements SQLQueryParser.ParserContext {
|
||||||
}
|
}
|
||||||
resultBuilderEntity.addProperty( propertyName, keyColumnAliases );
|
resultBuilderEntity.addProperty( propertyName, keyColumnAliases );
|
||||||
}
|
}
|
||||||
else if ( propertyType instanceof ComponentType ) {
|
else if ( propertyType instanceof ComponentType componentType ) {
|
||||||
final Map<String, FetchBuilder> fetchBuilderMap = new HashMap<>();
|
final Map<String, FetchBuilder> fetchBuilderMap = new HashMap<>();
|
||||||
final DynamicFetchBuilderLegacy fetchBuilder = new DynamicFetchBuilderLegacy(
|
final DynamicFetchBuilderLegacy fetchBuilder = new DynamicFetchBuilderLegacy(
|
||||||
"",
|
"",
|
||||||
|
@ -372,7 +367,6 @@ public class ResultSetMappingProcessor implements SQLQueryParser.ParserContext {
|
||||||
null,
|
null,
|
||||||
fetchBuilderMap
|
fetchBuilderMap
|
||||||
);
|
);
|
||||||
final ComponentType componentType = (ComponentType) propertyType;
|
|
||||||
final String[] propertyNames = componentType.getPropertyNames();
|
final String[] propertyNames = componentType.getPropertyNames();
|
||||||
final Type[] propertyTypes = componentType.getSubtypes();
|
final Type[] propertyTypes = componentType.getSubtypes();
|
||||||
int aliasIndex = 0;
|
int aliasIndex = 0;
|
||||||
|
@ -574,8 +568,7 @@ public class ResultSetMappingProcessor implements SQLQueryParser.ParserContext {
|
||||||
addCollection( role, alias, propertyResultsMap );
|
addCollection( role, alias, propertyResultsMap );
|
||||||
// collectionOwnerAliases.add( ownerAlias );
|
// collectionOwnerAliases.add( ownerAlias );
|
||||||
}
|
}
|
||||||
else if ( returnType instanceof EntityType ) {
|
else if ( returnType instanceof EntityType eType ) {
|
||||||
EntityType eType = ( EntityType ) returnType;
|
|
||||||
String returnEntityName = eType.getAssociatedEntityName();
|
String returnEntityName = eType.getAssociatedEntityName();
|
||||||
EntityPersister persister = getSQLLoadable( returnEntityName );
|
EntityPersister persister = getSQLLoadable( returnEntityName );
|
||||||
Map<String, String[]> propertyResultsMap = Collections.emptyMap();//fetchReturn.getPropertyResultsMap()
|
Map<String, String[]> propertyResultsMap = Collections.emptyMap();//fetchReturn.getPropertyResultsMap()
|
||||||
|
|
|
@ -24,7 +24,7 @@ import org.hibernate.query.QueryParameter;
|
||||||
import org.hibernate.query.ResultListTransformer;
|
import org.hibernate.query.ResultListTransformer;
|
||||||
import org.hibernate.query.TupleTransformer;
|
import org.hibernate.query.TupleTransformer;
|
||||||
import org.hibernate.query.named.NameableQuery;
|
import org.hibernate.query.named.NameableQuery;
|
||||||
import org.hibernate.query.results.dynamic.DynamicResultBuilderEntityStandard;
|
import org.hibernate.query.results.internal.dynamic.DynamicResultBuilderEntityStandard;
|
||||||
import org.hibernate.query.spi.QueryImplementor;
|
import org.hibernate.query.spi.QueryImplementor;
|
||||||
import org.hibernate.transform.ResultTransformer;
|
import org.hibernate.transform.ResultTransformer;
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ import org.hibernate.metamodel.mapping.SqlExpressible;
|
||||||
import org.hibernate.persister.entity.EntityPersister;
|
import org.hibernate.persister.entity.EntityPersister;
|
||||||
import org.hibernate.query.SemanticException;
|
import org.hibernate.query.SemanticException;
|
||||||
import org.hibernate.query.SortDirection;
|
import org.hibernate.query.SortDirection;
|
||||||
import org.hibernate.query.results.TableGroupImpl;
|
import org.hibernate.query.results.internal.TableGroupImpl;
|
||||||
import org.hibernate.query.spi.DomainQueryExecutionContext;
|
import org.hibernate.query.spi.DomainQueryExecutionContext;
|
||||||
import org.hibernate.query.sqm.BinaryArithmeticOperator;
|
import org.hibernate.query.sqm.BinaryArithmeticOperator;
|
||||||
import org.hibernate.query.sqm.ComparisonOperator;
|
import org.hibernate.query.sqm.ComparisonOperator;
|
||||||
|
|
|
@ -17,7 +17,7 @@ import org.hibernate.internal.util.collections.CollectionHelper;
|
||||||
import org.hibernate.metamodel.mapping.EntityMappingType;
|
import org.hibernate.metamodel.mapping.EntityMappingType;
|
||||||
import org.hibernate.persister.entity.EntityPersister;
|
import org.hibernate.persister.entity.EntityPersister;
|
||||||
import org.hibernate.query.SemanticException;
|
import org.hibernate.query.SemanticException;
|
||||||
import org.hibernate.query.results.TableGroupImpl;
|
import org.hibernate.query.results.internal.TableGroupImpl;
|
||||||
import org.hibernate.query.sqm.ComparisonOperator;
|
import org.hibernate.query.sqm.ComparisonOperator;
|
||||||
import org.hibernate.query.sqm.internal.DomainParameterXref;
|
import org.hibernate.query.sqm.internal.DomainParameterXref;
|
||||||
import org.hibernate.query.sqm.mutation.internal.MultiTableSqmMutationConverter;
|
import org.hibernate.query.sqm.mutation.internal.MultiTableSqmMutationConverter;
|
||||||
|
|
|
@ -39,7 +39,7 @@ import org.hibernate.metamodel.mapping.ModelPartContainer;
|
||||||
import org.hibernate.persister.entity.EntityPersister;
|
import org.hibernate.persister.entity.EntityPersister;
|
||||||
import org.hibernate.query.SemanticException;
|
import org.hibernate.query.SemanticException;
|
||||||
import org.hibernate.query.SortDirection;
|
import org.hibernate.query.SortDirection;
|
||||||
import org.hibernate.query.results.TableGroupImpl;
|
import org.hibernate.query.results.internal.TableGroupImpl;
|
||||||
import org.hibernate.query.spi.DomainQueryExecutionContext;
|
import org.hibernate.query.spi.DomainQueryExecutionContext;
|
||||||
import org.hibernate.query.sqm.ComparisonOperator;
|
import org.hibernate.query.sqm.ComparisonOperator;
|
||||||
import org.hibernate.query.common.FetchClauseType;
|
import org.hibernate.query.common.FetchClauseType;
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue