diff --git a/hibernate-core/src/main/java/org/hibernate/engine/spi/SessionFactoryImplementor.java b/hibernate-core/src/main/java/org/hibernate/engine/spi/SessionFactoryImplementor.java index 3e0b53be09..3953babda4 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/spi/SessionFactoryImplementor.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/spi/SessionFactoryImplementor.java @@ -39,8 +39,7 @@ import org.hibernate.persister.entity.EntityPersister; import org.hibernate.proxy.EntityNotFoundDelegate; import org.hibernate.query.spi.QueryEngine; import org.hibernate.query.spi.QueryParameterBindingTypeResolver; -import org.hibernate.query.sqm.NodeBuilder; -import org.hibernate.query.sqm.produce.spi.SqmCreationContext; +import org.hibernate.query.sqm.spi.SqmCreationContext; import org.hibernate.service.spi.ServiceRegistryImplementor; import org.hibernate.sql.ast.spi.SqlAstCreationContext; import org.hibernate.stat.spi.StatisticsImplementor; diff --git a/hibernate-core/src/main/java/org/hibernate/loader/internal/NaturalIdLoaderStandardImpl.java b/hibernate-core/src/main/java/org/hibernate/loader/internal/NaturalIdLoaderStandardImpl.java index 1016d4fb0c..57e2d7c3ff 100644 --- a/hibernate-core/src/main/java/org/hibernate/loader/internal/NaturalIdLoaderStandardImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/loader/internal/NaturalIdLoaderStandardImpl.java @@ -22,7 +22,6 @@ public class NaturalIdLoaderStandardImpl implements NaturalIdLoader { } @Override - @SuppressWarnings("unchecked") public EntityPersister getLoadable() { return entityDescriptor; } diff --git a/hibernate-core/src/main/java/org/hibernate/loader/spi/Loadable.java b/hibernate-core/src/main/java/org/hibernate/loader/spi/Loadable.java index fae153d838..68cd95fb03 100644 --- a/hibernate-core/src/main/java/org/hibernate/loader/spi/Loadable.java +++ b/hibernate-core/src/main/java/org/hibernate/loader/spi/Loadable.java @@ -18,7 +18,7 @@ import org.hibernate.metamodel.model.mapping.spi.ModelPart; * * @author Steve Ebersole */ -public interface Loadable extends ModelPart { +public interface Loadable extends ModelPart { boolean isAffectedByEnabledFilters(LoadQueryInfluencers influencers); boolean isAffectedByEntityGraph(LoadQueryInfluencers influencers); boolean isAffectedByEnabledFetchProfiles(LoadQueryInfluencers influencers); diff --git a/hibernate-core/src/main/java/org/hibernate/loader/spi/Loader.java b/hibernate-core/src/main/java/org/hibernate/loader/spi/Loader.java index b16b27f686..020b721d5e 100644 --- a/hibernate-core/src/main/java/org/hibernate/loader/spi/Loader.java +++ b/hibernate-core/src/main/java/org/hibernate/loader/spi/Loader.java @@ -11,9 +11,9 @@ package org.hibernate.loader.spi; * * @author Steve Ebersole */ -public interface Loader { +public interface Loader { /** * The value-mapping loaded by this loader */ - Loadable getLoadable(); + Loadable getLoadable(); } diff --git a/hibernate-core/src/main/java/org/hibernate/loader/spi/MultiIdEntityLoader.java b/hibernate-core/src/main/java/org/hibernate/loader/spi/MultiIdEntityLoader.java index b8aa953b5f..c13529fe9b 100644 --- a/hibernate-core/src/main/java/org/hibernate/loader/spi/MultiIdEntityLoader.java +++ b/hibernate-core/src/main/java/org/hibernate/loader/spi/MultiIdEntityLoader.java @@ -17,9 +17,8 @@ import org.hibernate.persister.entity.MultiLoadOptions; * * @author Steve Ebersole */ -public interface MultiIdEntityLoader extends Loader { +public interface MultiIdEntityLoader extends Loader { @Override - @SuppressWarnings("unchecked") EntityPersister getLoadable(); List load(Object[] ids, MultiLoadOptions options, SharedSessionContractImplementor session); diff --git a/hibernate-core/src/main/java/org/hibernate/loader/spi/NaturalIdLoader.java b/hibernate-core/src/main/java/org/hibernate/loader/spi/NaturalIdLoader.java index 3e1dc8b589..73b073ae88 100644 --- a/hibernate-core/src/main/java/org/hibernate/loader/spi/NaturalIdLoader.java +++ b/hibernate-core/src/main/java/org/hibernate/loader/spi/NaturalIdLoader.java @@ -14,7 +14,7 @@ import org.hibernate.engine.spi.SharedSessionContractImplementor; * * @author Steve Ebersole */ -public interface NaturalIdLoader extends Loader { +public interface NaturalIdLoader extends Loader { interface LoadOptions { /** * The locking options for the loaded entity diff --git a/hibernate-core/src/main/java/org/hibernate/loader/spi/SingleEntityLoader.java b/hibernate-core/src/main/java/org/hibernate/loader/spi/SingleEntityLoader.java index 03406207f7..fb3bfdc391 100644 --- a/hibernate-core/src/main/java/org/hibernate/loader/spi/SingleEntityLoader.java +++ b/hibernate-core/src/main/java/org/hibernate/loader/spi/SingleEntityLoader.java @@ -15,9 +15,8 @@ import org.hibernate.persister.entity.EntityPersister; * * @author Steve Ebersole */ -public interface SingleEntityLoader extends Loader { +public interface SingleEntityLoader extends Loader { @Override - @SuppressWarnings("unchecked") EntityPersister getLoadable(); /** diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/model/domain/AllowableParameterType.java b/hibernate-core/src/main/java/org/hibernate/metamodel/model/domain/AllowableParameterType.java index 6ebe59bcf6..d2bfeadbba 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/model/domain/AllowableParameterType.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/model/domain/AllowableParameterType.java @@ -7,19 +7,22 @@ package org.hibernate.metamodel.model.domain; import org.hibernate.Incubating; -import org.hibernate.metamodel.model.mapping.spi.ModelPart; -import org.hibernate.metamodel.model.mapping.spi.ValueMapping; +import org.hibernate.NotYetImplementedFor6Exception; +import org.hibernate.metamodel.model.mapping.spi.Writeable; import org.hibernate.query.Query; import org.hibernate.type.descriptor.java.JavaTypeDescriptor; +import org.hibernate.type.spi.TypeConfiguration; /** * Specialization of DomainType for types that can be used as {@link Query} parameter bind values. * - * todo (6.0) : Need a resolution between AllowableParameterType and {@link ValueMapping} / {@link ModelPart} - * * @author Steve Ebersole */ @Incubating public interface AllowableParameterType extends SimpleDomainType { JavaTypeDescriptor getExpressableJavaTypeDescriptor(); + + default Writeable resolveWriteable(TypeConfiguration typeConfiguration) { + throw new NotYetImplementedFor6Exception( getClass() ); + } } diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/model/domain/SimpleDomainType.java b/hibernate-core/src/main/java/org/hibernate/metamodel/model/domain/SimpleDomainType.java index c9480d2cbd..f39ab76a67 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/model/domain/SimpleDomainType.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/model/domain/SimpleDomainType.java @@ -6,6 +6,8 @@ */ package org.hibernate.metamodel.model.domain; +import org.hibernate.metamodel.model.mapping.spi.Writeable; + /** * Describes any non-collection type * diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/model/domain/internal/AbstractPluralAttribute.java b/hibernate-core/src/main/java/org/hibernate/metamodel/model/domain/internal/AbstractPluralAttribute.java index c49ab7e123..b245ba7e8a 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/model/domain/internal/AbstractPluralAttribute.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/model/domain/internal/AbstractPluralAttribute.java @@ -14,7 +14,7 @@ import org.hibernate.metamodel.model.domain.PluralPersistentAttribute; import org.hibernate.metamodel.model.domain.SimpleDomainType; import org.hibernate.query.NavigablePath; import org.hibernate.query.sqm.SqmPathSource; -import org.hibernate.query.sqm.produce.spi.SqmCreationState; +import org.hibernate.query.sqm.spi.SqmCreationState; import org.hibernate.query.sqm.tree.domain.SqmPath; import org.hibernate.query.sqm.tree.domain.SqmPluralValuedSimplePath; import org.hibernate.type.descriptor.java.JavaTypeDescriptor; diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/model/domain/internal/AnyMappingSqmPathSource.java b/hibernate-core/src/main/java/org/hibernate/metamodel/model/domain/internal/AnyMappingSqmPathSource.java index cc51717814..e798c2fb5c 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/model/domain/internal/AnyMappingSqmPathSource.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/model/domain/internal/AnyMappingSqmPathSource.java @@ -8,9 +8,8 @@ package org.hibernate.metamodel.model.domain.internal; import org.hibernate.NotYetImplementedFor6Exception; import org.hibernate.metamodel.model.domain.AnyMappingDomainType; -import org.hibernate.query.sqm.NodeBuilder; import org.hibernate.query.sqm.SqmPathSource; -import org.hibernate.query.sqm.produce.spi.SqmCreationState; +import org.hibernate.query.sqm.spi.SqmCreationState; import org.hibernate.query.sqm.tree.domain.SqmPath; /** diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/model/domain/internal/BagAttributeImpl.java b/hibernate-core/src/main/java/org/hibernate/metamodel/model/domain/internal/BagAttributeImpl.java index e9af92e0e5..6932ebe4ca 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/model/domain/internal/BagAttributeImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/model/domain/internal/BagAttributeImpl.java @@ -11,7 +11,7 @@ import java.util.Collection; import org.hibernate.NotYetImplementedFor6Exception; import org.hibernate.metamodel.model.domain.BagPersistentAttribute; import org.hibernate.query.sqm.SqmPathSource; -import org.hibernate.query.sqm.produce.spi.SqmCreationState; +import org.hibernate.query.sqm.spi.SqmCreationState; import org.hibernate.query.sqm.tree.SqmJoinType; import org.hibernate.query.sqm.tree.domain.SqmBagJoin; import org.hibernate.query.sqm.tree.from.SqmAttributeJoin; diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/model/domain/internal/BasicSqmPathSource.java b/hibernate-core/src/main/java/org/hibernate/metamodel/model/domain/internal/BasicSqmPathSource.java index c0459cb3c7..bba4afd610 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/model/domain/internal/BasicSqmPathSource.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/model/domain/internal/BasicSqmPathSource.java @@ -12,7 +12,7 @@ import org.hibernate.metamodel.model.domain.BasicDomainType; import org.hibernate.query.NavigablePath; import org.hibernate.query.sqm.IllegalPathUsageException; import org.hibernate.query.sqm.SqmPathSource; -import org.hibernate.query.sqm.produce.spi.SqmCreationState; +import org.hibernate.query.sqm.spi.SqmCreationState; import org.hibernate.query.sqm.tree.domain.SqmBasicValuedSimplePath; import org.hibernate.query.sqm.tree.domain.SqmPath; diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/model/domain/internal/EmbeddedSqmPathSource.java b/hibernate-core/src/main/java/org/hibernate/metamodel/model/domain/internal/EmbeddedSqmPathSource.java index 3b6bbb78fa..8c901daa51 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/model/domain/internal/EmbeddedSqmPathSource.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/model/domain/internal/EmbeddedSqmPathSource.java @@ -9,7 +9,7 @@ package org.hibernate.metamodel.model.domain.internal; import org.hibernate.metamodel.model.domain.AllowableParameterType; import org.hibernate.metamodel.model.domain.EmbeddableDomainType; import org.hibernate.query.sqm.SqmPathSource; -import org.hibernate.query.sqm.produce.spi.SqmCreationState; +import org.hibernate.query.sqm.spi.SqmCreationState; import org.hibernate.query.sqm.tree.domain.SqmEmbeddedValuedSimplePath; import org.hibernate.query.sqm.tree.domain.SqmPath; diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/model/domain/internal/EntitySqmPathSource.java b/hibernate-core/src/main/java/org/hibernate/metamodel/model/domain/internal/EntitySqmPathSource.java index c7958dc11f..2b18c364b2 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/model/domain/internal/EntitySqmPathSource.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/model/domain/internal/EntitySqmPathSource.java @@ -10,9 +10,8 @@ import org.hibernate.metamodel.model.domain.EntityDomainType; import org.hibernate.metamodel.model.domain.PersistentAttribute; import org.hibernate.metamodel.model.domain.SingularPersistentAttribute; import org.hibernate.query.SemanticException; -import org.hibernate.query.sqm.NodeBuilder; import org.hibernate.query.sqm.SqmPathSource; -import org.hibernate.query.sqm.produce.spi.SqmCreationState; +import org.hibernate.query.sqm.spi.SqmCreationState; import org.hibernate.query.sqm.tree.domain.SqmEntityValuedSimplePath; import org.hibernate.query.sqm.tree.domain.SqmPath; diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/model/domain/internal/EntityTypeImpl.java b/hibernate-core/src/main/java/org/hibernate/metamodel/model/domain/internal/EntityTypeImpl.java index 90f4dca2da..f401345c52 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/model/domain/internal/EntityTypeImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/model/domain/internal/EntityTypeImpl.java @@ -19,7 +19,7 @@ import org.hibernate.metamodel.model.domain.JpaMetamodel; import org.hibernate.metamodel.model.domain.PersistentAttribute; import org.hibernate.metamodel.model.domain.SingularPersistentAttribute; import org.hibernate.query.sqm.SqmPathSource; -import org.hibernate.query.sqm.produce.spi.SqmCreationState; +import org.hibernate.query.sqm.spi.SqmCreationState; import org.hibernate.query.sqm.tree.domain.SqmPath; import org.hibernate.type.descriptor.java.JavaTypeDescriptor; diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/model/domain/internal/ListAttributeImpl.java b/hibernate-core/src/main/java/org/hibernate/metamodel/model/domain/internal/ListAttributeImpl.java index 7df3a3bf7d..a254efa55a 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/model/domain/internal/ListAttributeImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/model/domain/internal/ListAttributeImpl.java @@ -10,7 +10,7 @@ import java.util.List; import org.hibernate.metamodel.model.domain.ListPersistentAttribute; import org.hibernate.query.sqm.SqmPathSource; -import org.hibernate.query.sqm.produce.spi.SqmCreationState; +import org.hibernate.query.sqm.spi.SqmCreationState; import org.hibernate.query.sqm.tree.SqmJoinType; import org.hibernate.query.sqm.tree.domain.SqmListJoin; import org.hibernate.query.sqm.tree.from.SqmAttributeJoin; diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/model/domain/internal/MapAttributeImpl.java b/hibernate-core/src/main/java/org/hibernate/metamodel/model/domain/internal/MapAttributeImpl.java index 8b19b51c75..80988f6a7b 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/model/domain/internal/MapAttributeImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/model/domain/internal/MapAttributeImpl.java @@ -12,7 +12,7 @@ import org.hibernate.NotYetImplementedFor6Exception; import org.hibernate.metamodel.model.domain.MapPersistentAttribute; import org.hibernate.metamodel.model.domain.SimpleDomainType; import org.hibernate.query.sqm.SqmPathSource; -import org.hibernate.query.sqm.produce.spi.SqmCreationState; +import org.hibernate.query.sqm.spi.SqmCreationState; import org.hibernate.query.sqm.tree.SqmJoinType; import org.hibernate.query.sqm.tree.domain.SqmMapJoin; import org.hibernate.query.sqm.tree.from.SqmAttributeJoin; diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/model/domain/internal/SetAttributeImpl.java b/hibernate-core/src/main/java/org/hibernate/metamodel/model/domain/internal/SetAttributeImpl.java index e3d79c9618..73fc861586 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/model/domain/internal/SetAttributeImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/model/domain/internal/SetAttributeImpl.java @@ -9,7 +9,7 @@ package org.hibernate.metamodel.model.domain.internal; import java.util.Set; import org.hibernate.metamodel.model.domain.SetPersistentAttribute; -import org.hibernate.query.sqm.produce.spi.SqmCreationState; +import org.hibernate.query.sqm.spi.SqmCreationState; import org.hibernate.query.sqm.tree.SqmJoinType; import org.hibernate.query.sqm.tree.domain.SqmSetJoin; import org.hibernate.query.sqm.tree.from.SqmAttributeJoin; diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/model/domain/internal/SingularAttributeImpl.java b/hibernate-core/src/main/java/org/hibernate/metamodel/model/domain/internal/SingularAttributeImpl.java index 99b54b46b1..bb946da18e 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/model/domain/internal/SingularAttributeImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/model/domain/internal/SingularAttributeImpl.java @@ -16,7 +16,7 @@ import org.hibernate.metamodel.model.domain.ManagedDomainType; import org.hibernate.metamodel.model.domain.SimpleDomainType; import org.hibernate.metamodel.model.domain.SingularPersistentAttribute; import org.hibernate.query.sqm.SqmPathSource; -import org.hibernate.query.sqm.produce.spi.SqmCreationState; +import org.hibernate.query.sqm.spi.SqmCreationState; import org.hibernate.query.sqm.tree.SqmJoinType; import org.hibernate.query.sqm.tree.domain.SqmPath; import org.hibernate.query.sqm.tree.domain.SqmSingularJoin; diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/model/mapping/spi/ModelPart.java b/hibernate-core/src/main/java/org/hibernate/metamodel/model/mapping/spi/ModelPart.java index 268d994be8..fe1b3484c2 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/model/mapping/spi/ModelPart.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/model/mapping/spi/ModelPart.java @@ -21,11 +21,12 @@ import org.hibernate.sql.results.spi.DomainResultProducer; * * @author Steve Ebersole */ -public interface ModelPart extends Readable, Writeable { +public interface ModelPart { + /** * Create a DomainResult for a specific reference to this ModelPart. */ - default DomainResult createDomainResult( + default DomainResult createDomainResult( NavigablePath navigablePath, int valuesArrayPosition, String resultVariable, @@ -41,4 +42,9 @@ public interface ModelPart extends Readable, Writeable { DomainResultCreationState creationState) { throw new NotYetImplementedFor6Exception( getClass() ); } + + default Writeable getWriteable() { + // todo (6.0) : or in-line + throw new NotYetImplementedFor6Exception( getClass() ); + } } diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/model/mapping/spi/Readable.java b/hibernate-core/src/main/java/org/hibernate/metamodel/model/mapping/spi/Readable.java deleted file mode 100644 index 93763c7120..0000000000 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/model/mapping/spi/Readable.java +++ /dev/null @@ -1,57 +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 - */ -package org.hibernate.metamodel.model.mapping.spi; - -import java.util.function.Consumer; - -import org.hibernate.NotYetImplementedFor6Exception; -import org.hibernate.persister.SqlExpressableType; -import org.hibernate.query.NavigablePath; -import org.hibernate.sql.results.spi.DomainResult; -import org.hibernate.sql.results.spi.DomainResultCreationState; -import org.hibernate.type.spi.TypeConfiguration; - -/** - * Contract for things at the domain/mapping level that can be extracted from a JDBC result - * - * Really, reading/loading stuff is defined via {@link DomainResult} and - * {@link org.hibernate.sql.results.spi.Initializer}. This contract simply works as a sort - * of extended `DomainResultProducer` specifically for mapped-parts of a domain model - * - * @author Steve Ebersole - */ -public interface Readable { - - /** - * Visit all of the SqlExpressableTypes associated with this this Readable. - * - * Used during cacheable SQL AST creation. - */ - default void visitJdbcTypes(Consumer action, TypeConfiguration typeConfiguration) { - throw new NotYetImplementedFor6Exception( getClass() ); - } - - /** - * Create a DomainResult for a specific reference to this ModelPart. - */ - default DomainResult createDomainResult( - NavigablePath navigablePath, - int valuesArrayPosition, - String resultVariable, - DomainResultCreationState creationState) { - throw new NotYetImplementedFor6Exception( getClass() ); - } - - /** - * Apply SQL selections for a specific reference to this ModelPart outside the domain query's root select clause. - */ - default void applySqlSelections( - NavigablePath navigablePath, - DomainResultCreationState creationState) { - throw new NotYetImplementedFor6Exception( getClass() ); - } -} diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/model/mapping/spi/ValueMapping.java b/hibernate-core/src/main/java/org/hibernate/metamodel/model/mapping/spi/ValueMapping.java index 37c08be6f3..ab6153c138 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/model/mapping/spi/ValueMapping.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/model/mapping/spi/ValueMapping.java @@ -21,7 +21,7 @@ import org.hibernate.type.Type; * * @author Steve Ebersole */ -public interface ValueMapping extends ModelPart { +public interface ValueMapping extends ModelPart { /** * Get the Type associated with this mapping diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/model/mapping/spi/ValueMappingContainer.java b/hibernate-core/src/main/java/org/hibernate/metamodel/model/mapping/spi/ValueMappingContainer.java index c6615b2efb..ed0e0c446f 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/model/mapping/spi/ValueMappingContainer.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/model/mapping/spi/ValueMappingContainer.java @@ -15,18 +15,18 @@ import org.hibernate.NotYetImplementedFor6Exception; * * @author Steve Ebersole */ -public interface ValueMappingContainer extends ModelPart { +public interface ValueMappingContainer extends ModelPart { /** * Find a sub-ValueMapping by name */ - default ValueMapping findValueMapping(String name){ + default ValueMapping findValueMapping(String name){ throw new NotYetImplementedFor6Exception( getClass() ); } /** * Visit all of this container's sub-ValueMappings */ - default void visitValueMappings(Consumer> consumer){ + default void visitValueMappings(Consumer consumer){ throw new NotYetImplementedFor6Exception( getClass() ); } diff --git a/hibernate-core/src/main/java/org/hibernate/query/hql/internal/BasicDotIdentifierConsumer.java b/hibernate-core/src/main/java/org/hibernate/query/hql/internal/BasicDotIdentifierConsumer.java index 987b94ce60..d1828bf2ff 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/hql/internal/BasicDotIdentifierConsumer.java +++ b/hibernate-core/src/main/java/org/hibernate/query/hql/internal/BasicDotIdentifierConsumer.java @@ -14,8 +14,8 @@ import org.hibernate.query.hql.spi.SemanticPathPart; import org.hibernate.query.hql.spi.SqmPathRegistry; import org.hibernate.query.sqm.ParsingException; import org.hibernate.query.sqm.SqmPathSource; -import org.hibernate.query.sqm.produce.spi.SqmCreationContext; -import org.hibernate.query.sqm.produce.spi.SqmCreationState; +import org.hibernate.query.sqm.spi.SqmCreationContext; +import org.hibernate.query.sqm.spi.SqmCreationState; import org.hibernate.query.sqm.tree.domain.SqmPath; import org.hibernate.query.sqm.tree.expression.SqmEnumLiteral; import org.hibernate.query.sqm.tree.expression.SqmExpression; diff --git a/hibernate-core/src/main/java/org/hibernate/query/hql/internal/DomainPathPart.java b/hibernate-core/src/main/java/org/hibernate/query/hql/internal/DomainPathPart.java index 2bbf2565f3..869c63fbcd 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/hql/internal/DomainPathPart.java +++ b/hibernate-core/src/main/java/org/hibernate/query/hql/internal/DomainPathPart.java @@ -10,7 +10,7 @@ import org.hibernate.NotYetImplementedFor6Exception; import org.hibernate.query.SemanticException; import org.hibernate.query.hql.spi.SemanticPathPart; import org.hibernate.query.sqm.SqmPathSource; -import org.hibernate.query.sqm.produce.spi.SqmCreationState; +import org.hibernate.query.sqm.spi.SqmCreationState; import org.hibernate.query.sqm.tree.domain.SqmPath; import org.hibernate.query.sqm.tree.expression.SqmExpression; diff --git a/hibernate-core/src/main/java/org/hibernate/query/hql/internal/FullyQualifiedReflectivePath.java b/hibernate-core/src/main/java/org/hibernate/query/hql/internal/FullyQualifiedReflectivePath.java index bf609c2ca9..4288153345 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/hql/internal/FullyQualifiedReflectivePath.java +++ b/hibernate-core/src/main/java/org/hibernate/query/hql/internal/FullyQualifiedReflectivePath.java @@ -7,7 +7,7 @@ package org.hibernate.query.hql.internal; import org.hibernate.query.hql.spi.SemanticPathPart; -import org.hibernate.query.sqm.produce.spi.SqmCreationState; +import org.hibernate.query.sqm.spi.SqmCreationState; import org.hibernate.query.sqm.tree.domain.SqmPath; import org.hibernate.query.sqm.tree.expression.SqmExpression; diff --git a/hibernate-core/src/main/java/org/hibernate/query/hql/internal/FullyQualifiedReflectivePathTerminal.java b/hibernate-core/src/main/java/org/hibernate/query/hql/internal/FullyQualifiedReflectivePathTerminal.java index 61439d9037..cff452d02b 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/hql/internal/FullyQualifiedReflectivePathTerminal.java +++ b/hibernate-core/src/main/java/org/hibernate/query/hql/internal/FullyQualifiedReflectivePathTerminal.java @@ -12,7 +12,6 @@ import java.math.BigInteger; import java.util.Collection; import java.util.List; import java.util.function.Function; - import javax.persistence.criteria.Expression; import org.hibernate.boot.registry.classloading.spi.ClassLoaderService; @@ -22,13 +21,14 @@ import org.hibernate.query.criteria.JpaSelection; import org.hibernate.query.hql.HqlInterpretationException; import org.hibernate.query.sqm.NodeBuilder; import org.hibernate.query.sqm.SqmExpressable; -import org.hibernate.query.sqm.consume.spi.SemanticQueryWalker; -import org.hibernate.query.sqm.produce.spi.SqmCreationState; +import org.hibernate.query.sqm.spi.SemanticQueryWalker; +import org.hibernate.query.sqm.spi.SqmCreationState; import org.hibernate.query.sqm.tree.expression.SqmEnumLiteral; import org.hibernate.query.sqm.tree.expression.SqmExpression; import org.hibernate.query.sqm.tree.expression.SqmFieldLiteral; import org.hibernate.query.sqm.tree.expression.SqmLiteralEntityType; import org.hibernate.query.sqm.tree.predicate.SqmPredicate; +import org.hibernate.sql.results.spi.DomainResultProducer; import org.hibernate.type.descriptor.java.EnumJavaTypeDescriptor; import org.hibernate.type.descriptor.java.JavaTypeDescriptor; @@ -239,4 +239,9 @@ public class FullyQualifiedReflectivePathTerminal public NodeBuilder nodeBuilder() { return null; } + + @Override + public DomainResultProducer getDomainResultProducer() { + throw new UnsupportedOperationException( ); + } } diff --git a/hibernate-core/src/main/java/org/hibernate/query/hql/internal/QualifiedJoinPathConsumer.java b/hibernate-core/src/main/java/org/hibernate/query/hql/internal/QualifiedJoinPathConsumer.java index 6c7412c33a..ae200aa2c3 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/hql/internal/QualifiedJoinPathConsumer.java +++ b/hibernate-core/src/main/java/org/hibernate/query/hql/internal/QualifiedJoinPathConsumer.java @@ -14,8 +14,8 @@ import org.hibernate.query.hql.spi.SemanticPathPart; import org.hibernate.query.hql.spi.SqmPathRegistry; import org.hibernate.query.sqm.SqmJoinable; import org.hibernate.query.sqm.SqmPathSource; -import org.hibernate.query.sqm.produce.spi.SqmCreationProcessingState; -import org.hibernate.query.sqm.produce.spi.SqmCreationState; +import org.hibernate.query.sqm.spi.SqmCreationProcessingState; +import org.hibernate.query.sqm.spi.SqmCreationState; import org.hibernate.query.sqm.tree.SqmJoinType; import org.hibernate.query.sqm.tree.domain.SqmPolymorphicRootDescriptor; import org.hibernate.query.sqm.tree.from.SqmAttributeJoin; diff --git a/hibernate-core/src/main/java/org/hibernate/query/hql/internal/QualifiedJoinPredicatePathConsumer.java b/hibernate-core/src/main/java/org/hibernate/query/hql/internal/QualifiedJoinPredicatePathConsumer.java index 36aae2c236..6d551f851f 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/hql/internal/QualifiedJoinPredicatePathConsumer.java +++ b/hibernate-core/src/main/java/org/hibernate/query/hql/internal/QualifiedJoinPredicatePathConsumer.java @@ -10,10 +10,9 @@ import java.util.Locale; import org.hibernate.query.SemanticException; import org.hibernate.query.hql.spi.SemanticPathPart; -import org.hibernate.query.sqm.produce.spi.SqmCreationState; +import org.hibernate.query.sqm.spi.SqmCreationState; import org.hibernate.query.sqm.tree.from.SqmFrom; import org.hibernate.query.sqm.tree.from.SqmQualifiedJoin; -import org.hibernate.query.sqm.tree.from.SqmRoot; /** * Specialized consumer for processing domain model paths occurring as part diff --git a/hibernate-core/src/main/java/org/hibernate/query/hql/internal/QuerySplitter.java b/hibernate-core/src/main/java/org/hibernate/query/hql/internal/QuerySplitter.java index ddb799ab68..aa0a288096 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/hql/internal/QuerySplitter.java +++ b/hibernate-core/src/main/java/org/hibernate/query/hql/internal/QuerySplitter.java @@ -14,12 +14,12 @@ import org.hibernate.engine.spi.SessionFactoryImplementor; import org.hibernate.internal.util.collections.Stack; import org.hibernate.metamodel.model.domain.EntityDomainType; import org.hibernate.query.NavigablePath; -import org.hibernate.query.sqm.consume.spi.BaseSemanticQueryWalker; -import org.hibernate.query.sqm.produce.spi.SqmCreationProcessingState; +import org.hibernate.query.sqm.spi.BaseSemanticQueryWalker; +import org.hibernate.query.sqm.spi.SqmCreationProcessingState; import org.hibernate.query.hql.spi.SqmPathRegistry; -import org.hibernate.query.sqm.produce.spi.SqmCreationContext; -import org.hibernate.query.sqm.produce.spi.SqmCreationOptions; -import org.hibernate.query.sqm.produce.spi.SqmCreationState; +import org.hibernate.query.sqm.spi.SqmCreationContext; +import org.hibernate.query.sqm.spi.SqmCreationOptions; +import org.hibernate.query.sqm.spi.SqmCreationState; import org.hibernate.query.sqm.tree.delete.SqmDeleteStatement; import org.hibernate.query.sqm.tree.domain.SqmBasicValuedSimplePath; import org.hibernate.query.sqm.tree.domain.SqmEmbeddedValuedSimplePath; diff --git a/hibernate-core/src/main/java/org/hibernate/query/hql/internal/SemanticQueryBuilder.java b/hibernate-core/src/main/java/org/hibernate/query/hql/internal/SemanticQueryBuilder.java index 3c393bdb4e..eebbb45552 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/hql/internal/SemanticQueryBuilder.java +++ b/hibernate-core/src/main/java/org/hibernate/query/hql/internal/SemanticQueryBuilder.java @@ -55,18 +55,16 @@ import org.hibernate.query.sqm.function.SqmExtractUnit; import org.hibernate.query.sqm.function.SqmStar; import org.hibernate.query.sqm.function.SqmTrimSpecification; import org.hibernate.query.sqm.internal.ParameterCollector; -import org.hibernate.query.sqm.produce.SqmTreeCreationLogger; +import org.hibernate.query.sqm.spi.SqmTreeCreationLogger; import org.hibernate.query.sqm.produce.function.SqmFunctionTemplate; import org.hibernate.query.sqm.produce.function.spi.NamedSqmFunctionTemplate; -import org.hibernate.query.sqm.produce.internal.SqmDmlCreationProcessingState; -import org.hibernate.query.sqm.produce.internal.SqmQuerySpecCreationProcessingStateStandardImpl; -import org.hibernate.query.sqm.produce.internal.UniqueIdGenerator; -import org.hibernate.query.sqm.produce.spi.ImplicitAliasGenerator; -import org.hibernate.query.sqm.produce.spi.ParameterDeclarationContext; -import org.hibernate.query.sqm.produce.spi.SqmCreationContext; -import org.hibernate.query.sqm.produce.spi.SqmCreationOptions; -import org.hibernate.query.sqm.produce.spi.SqmCreationProcessingState; -import org.hibernate.query.sqm.produce.spi.SqmCreationState; +import org.hibernate.query.sqm.internal.SqmDmlCreationProcessingState; +import org.hibernate.query.sqm.internal.SqmQuerySpecCreationProcessingStateStandardImpl; +import org.hibernate.query.sqm.spi.ParameterDeclarationContext; +import org.hibernate.query.sqm.spi.SqmCreationContext; +import org.hibernate.query.sqm.spi.SqmCreationOptions; +import org.hibernate.query.sqm.spi.SqmCreationProcessingState; +import org.hibernate.query.sqm.spi.SqmCreationState; import org.hibernate.query.sqm.tree.SqmJoinType; import org.hibernate.query.sqm.tree.SqmStatement; import org.hibernate.query.sqm.tree.SqmTypedNode; diff --git a/hibernate-core/src/main/java/org/hibernate/query/hql/internal/SemanticQueryProducerImpl.java b/hibernate-core/src/main/java/org/hibernate/query/hql/internal/SemanticQueryProducerImpl.java index 9706dff6bd..59a513330e 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/hql/internal/SemanticQueryProducerImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/query/hql/internal/SemanticQueryProducerImpl.java @@ -9,9 +9,9 @@ package org.hibernate.query.hql.internal; import org.hibernate.QueryException; import org.hibernate.query.sqm.InterpretationException; import org.hibernate.query.hql.SemanticQueryProducer; -import org.hibernate.query.sqm.produce.internal.SqmTreePrinter; -import org.hibernate.query.sqm.produce.spi.SqmCreationContext; -import org.hibernate.query.sqm.produce.spi.SqmCreationOptions; +import org.hibernate.query.sqm.internal.SqmTreePrinter; +import org.hibernate.query.sqm.spi.SqmCreationContext; +import org.hibernate.query.sqm.spi.SqmCreationOptions; import org.hibernate.query.sqm.tree.SqmStatement; /** diff --git a/hibernate-core/src/main/java/org/hibernate/query/hql/internal/SqmPathRegistryImpl.java b/hibernate-core/src/main/java/org/hibernate/query/hql/internal/SqmPathRegistryImpl.java index f788d638e6..28d6ad88fa 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/hql/internal/SqmPathRegistryImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/query/hql/internal/SqmPathRegistryImpl.java @@ -18,8 +18,8 @@ import org.hibernate.query.hql.spi.SqmPathRegistry; import org.hibernate.query.sqm.AliasCollisionException; import org.hibernate.query.sqm.ParsingException; import org.hibernate.query.sqm.SqmPathSource; -import org.hibernate.query.sqm.produce.spi.SqmCreationProcessingState; -import org.hibernate.query.sqm.produce.SqmTreeCreationLogger; +import org.hibernate.query.sqm.spi.SqmCreationProcessingState; +import org.hibernate.query.sqm.spi.SqmTreeCreationLogger; import org.hibernate.query.sqm.tree.domain.SqmPath; import org.hibernate.query.sqm.tree.from.SqmFrom; import org.hibernate.query.sqm.tree.select.SqmSelection; diff --git a/hibernate-core/src/main/java/org/hibernate/query/hql/spi/SemanticPathPart.java b/hibernate-core/src/main/java/org/hibernate/query/hql/spi/SemanticPathPart.java index 112dcf582f..03e340294f 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/hql/spi/SemanticPathPart.java +++ b/hibernate-core/src/main/java/org/hibernate/query/hql/spi/SemanticPathPart.java @@ -6,7 +6,7 @@ */ package org.hibernate.query.hql.spi; -import org.hibernate.query.sqm.produce.spi.SqmCreationState; +import org.hibernate.query.sqm.spi.SqmCreationState; import org.hibernate.query.sqm.tree.domain.SqmPath; import org.hibernate.query.sqm.tree.expression.SqmExpression; import org.hibernate.query.sqm.tree.domain.SqmSimplePath; diff --git a/hibernate-core/src/main/java/org/hibernate/query/spi/QueryEngine.java b/hibernate-core/src/main/java/org/hibernate/query/spi/QueryEngine.java index c909b7c27f..da220b177a 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/spi/QueryEngine.java +++ b/hibernate-core/src/main/java/org/hibernate/query/spi/QueryEngine.java @@ -24,9 +24,9 @@ import org.hibernate.query.sqm.internal.SqmCriteriaNodeBuilder; import org.hibernate.query.hql.SemanticQueryProducer; import org.hibernate.query.sqm.produce.function.SqmFunctionRegistry; import org.hibernate.query.hql.internal.SemanticQueryProducerImpl ; -import org.hibernate.query.sqm.produce.internal.SqmCreationOptionsStandard; -import org.hibernate.query.sqm.produce.spi.SqmCreationContext; -import org.hibernate.query.sqm.produce.spi.SqmCreationOptions; +import org.hibernate.query.sqm.internal.SqmCreationOptionsStandard; +import org.hibernate.query.sqm.spi.SqmCreationContext; +import org.hibernate.query.sqm.spi.SqmCreationOptions; import org.hibernate.service.ServiceRegistry; /** diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/SqmJoinable.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/SqmJoinable.java index 833436b76d..e5d919912d 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/SqmJoinable.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/SqmJoinable.java @@ -6,7 +6,7 @@ */ package org.hibernate.query.sqm; -import org.hibernate.query.sqm.produce.spi.SqmCreationState; +import org.hibernate.query.sqm.spi.SqmCreationState; import org.hibernate.query.sqm.tree.SqmJoinType; import org.hibernate.query.sqm.tree.from.SqmAttributeJoin; import org.hibernate.query.sqm.tree.from.SqmFrom; diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/SqmPathSource.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/SqmPathSource.java index 63172425c7..17225e6cba 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/SqmPathSource.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/SqmPathSource.java @@ -10,7 +10,7 @@ import java.util.Locale; import javax.persistence.metamodel.Bindable; import org.hibernate.metamodel.model.domain.DomainType; -import org.hibernate.query.sqm.produce.spi.SqmCreationState; +import org.hibernate.query.sqm.spi.SqmCreationState; import org.hibernate.query.sqm.tree.domain.SqmPath; /** diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/consume/package-info.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/consume/package-info.java deleted file mode 100644 index 83da60e340..0000000000 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/consume/package-info.java +++ /dev/null @@ -1,22 +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 - */ - -/** - * - *

- * Once you have received a {@link org.hibernate.query.sqm.tree.SqmStatement} from - * SemanticQueryInterpreter you can:

    - *
  • - * "Split" it (if it is a {@link org.hibernate.query.sqm.tree.select.SqmSelectStatement}) - * using {@link org.hibernate.query.hql.internal.QuerySplitter} - *
  • - *
  • - * Create a walker/visitor for it using {@link org.hibernate.query.sqm.consume.spi.BaseSemanticQueryWalker} - *
  • - *
- */ -package org.hibernate.query.sqm.consume; diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/consume/spi/Callback.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/consume/spi/Callback.java deleted file mode 100644 index e6190f7e00..0000000000 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/consume/spi/Callback.java +++ /dev/null @@ -1,21 +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 - */ - -package org.hibernate.query.sqm.consume.spi; - -import org.hibernate.loader.spi.AfterLoadAction; - -/** - * Callback to allow SQM interpretation to trigger certain things within ORM. See the current - * {@link AfterLoadAction} javadocs for details. Specifically this would - * encompass things like follow-on locking, follow-on fetching, etc. - * - * @author Steve Ebersole - */ -public interface Callback { - void registerAfterLoadAction(AfterLoadAction afterLoadAction); -} diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/function/SqmCastTarget.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/function/SqmCastTarget.java index 656c190125..e9b6bb4d76 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/function/SqmCastTarget.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/function/SqmCastTarget.java @@ -9,7 +9,7 @@ package org.hibernate.query.sqm.function; import org.hibernate.metamodel.model.domain.AllowableFunctionReturnType; import org.hibernate.query.sqm.NodeBuilder; import org.hibernate.query.sqm.SqmExpressable; -import org.hibernate.query.sqm.consume.spi.SemanticQueryWalker; +import org.hibernate.query.sqm.spi.SemanticQueryWalker; import org.hibernate.query.sqm.tree.AbstractSqmNode; import org.hibernate.query.sqm.tree.SqmTypedNode; import org.hibernate.query.sqm.tree.SqmVisitableNode; diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/function/SqmCoalesce.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/function/SqmCoalesce.java index 7d00fde21a..2c82f3794b 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/function/SqmCoalesce.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/function/SqmCoalesce.java @@ -15,10 +15,11 @@ import org.hibernate.metamodel.model.domain.AllowableFunctionReturnType; import org.hibernate.query.criteria.JpaCoalesce; import org.hibernate.query.criteria.JpaExpression; import org.hibernate.query.sqm.NodeBuilder; -import org.hibernate.query.sqm.consume.spi.SemanticQueryWalker; +import org.hibernate.query.sqm.spi.SemanticQueryWalker; import org.hibernate.query.sqm.produce.function.SqmFunctionTemplate; import org.hibernate.query.sqm.tree.expression.AbstractSqmExpression; import org.hibernate.query.sqm.tree.expression.SqmExpression; +import org.hibernate.sql.results.spi.DomainResultProducer; /** * Specialized CASE statement for resolving the first non-null value in a list of values @@ -26,7 +27,7 @@ import org.hibernate.query.sqm.tree.expression.SqmExpression; * @author Steve Ebersole * @author Gavin King */ -public class SqmCoalesce extends AbstractSqmExpression implements JpaCoalesce { +public class SqmCoalesce extends AbstractSqmExpression implements JpaCoalesce, DomainResultProducer { private List> arguments = new ArrayList<>(); private SqmFunctionTemplate coalesceFunction; @@ -102,4 +103,8 @@ public class SqmCoalesce extends AbstractSqmExpression implements JpaCoale return this; } + @Override + public DomainResultProducer getDomainResultProducer() { + return this; + } } diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/function/SqmDistinct.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/function/SqmDistinct.java index 24925ceea0..9f2bbe0296 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/function/SqmDistinct.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/function/SqmDistinct.java @@ -8,7 +8,7 @@ package org.hibernate.query.sqm.function; import org.hibernate.query.sqm.NodeBuilder; import org.hibernate.query.sqm.SqmExpressable; -import org.hibernate.query.sqm.consume.spi.SemanticQueryWalker; +import org.hibernate.query.sqm.spi.SemanticQueryWalker; import org.hibernate.query.sqm.tree.AbstractSqmNode; import org.hibernate.query.sqm.tree.SqmTypedNode; import org.hibernate.query.sqm.tree.SqmVisitableNode; diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/function/SqmExtractUnit.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/function/SqmExtractUnit.java index d226bcd35f..963a172540 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/function/SqmExtractUnit.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/function/SqmExtractUnit.java @@ -9,7 +9,7 @@ package org.hibernate.query.sqm.function; import org.hibernate.metamodel.model.domain.AllowableFunctionReturnType; import org.hibernate.query.sqm.NodeBuilder; import org.hibernate.query.sqm.SqmExpressable; -import org.hibernate.query.sqm.consume.spi.SemanticQueryWalker; +import org.hibernate.query.sqm.spi.SemanticQueryWalker; import org.hibernate.query.sqm.tree.AbstractSqmNode; import org.hibernate.query.sqm.tree.SqmTypedNode; import org.hibernate.query.sqm.tree.SqmVisitableNode; diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/function/SqmFunction.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/function/SqmFunction.java index 6f1f9cddaf..54eeb2a888 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/function/SqmFunction.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/function/SqmFunction.java @@ -7,8 +7,9 @@ package org.hibernate.query.sqm.function; import org.hibernate.query.criteria.JpaFunction; -import org.hibernate.query.sqm.consume.spi.SemanticQueryWalker; +import org.hibernate.query.sqm.spi.SemanticQueryWalker; import org.hibernate.query.sqm.tree.expression.SqmExpression; +import org.hibernate.sql.results.spi.DomainResultProducer; /** * Contract for functions impls that would like to control the @@ -20,7 +21,7 @@ import org.hibernate.query.sqm.tree.expression.SqmExpression; * * @author Steve Ebersole */ -public interface SqmFunction extends SqmExpression, JpaFunction { +public interface SqmFunction extends SqmExpression, JpaFunction, DomainResultProducer { // /** // * Generate the SQL AST form of the function as an expression. // * @@ -35,4 +36,9 @@ public interface SqmFunction extends SqmExpression, JpaFunction { default X accept(SemanticQueryWalker walker) { return walker.visitFunction( this ); } + + @Override + default DomainResultProducer getDomainResultProducer() { + return this; + } } diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/function/SqmStar.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/function/SqmStar.java index adf83da795..d2c6dd27b0 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/function/SqmStar.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/function/SqmStar.java @@ -7,8 +7,9 @@ package org.hibernate.query.sqm.function; import org.hibernate.query.sqm.NodeBuilder; -import org.hibernate.query.sqm.consume.spi.SemanticQueryWalker; +import org.hibernate.query.sqm.spi.SemanticQueryWalker; import org.hibernate.query.sqm.tree.expression.AbstractSqmExpression; +import org.hibernate.sql.results.spi.DomainResultProducer; /** * @author Gavin King @@ -23,4 +24,9 @@ public class SqmStar extends AbstractSqmExpression { public X accept(SemanticQueryWalker walker) { return walker.visitStar(this); } + + @Override + public DomainResultProducer getDomainResultProducer() { + throw new UnsupportedOperationException( ); + } } diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/function/SqmTrimSpecification.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/function/SqmTrimSpecification.java index 28d78fba40..757a385dd1 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/function/SqmTrimSpecification.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/function/SqmTrimSpecification.java @@ -9,7 +9,7 @@ package org.hibernate.query.sqm.function; import org.hibernate.query.TrimSpec; import org.hibernate.query.sqm.NodeBuilder; import org.hibernate.query.sqm.SqmExpressable; -import org.hibernate.query.sqm.consume.spi.SemanticQueryWalker; +import org.hibernate.query.sqm.spi.SemanticQueryWalker; import org.hibernate.query.sqm.tree.AbstractSqmNode; import org.hibernate.query.sqm.tree.SqmTypedNode; import org.hibernate.query.sqm.tree.SqmVisitableNode; diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/produce/internal/SqmCreationOptionsStandard.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/internal/SqmCreationOptionsStandard.java similarity index 86% rename from hibernate-core/src/main/java/org/hibernate/query/sqm/produce/internal/SqmCreationOptionsStandard.java rename to hibernate-core/src/main/java/org/hibernate/query/sqm/internal/SqmCreationOptionsStandard.java index 1eb0a9723b..6529c5b7ab 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/produce/internal/SqmCreationOptionsStandard.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/internal/SqmCreationOptionsStandard.java @@ -4,10 +4,10 @@ * 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 */ -package org.hibernate.query.sqm.produce.internal; +package org.hibernate.query.sqm.internal; import org.hibernate.engine.spi.SessionFactoryImplementor; -import org.hibernate.query.sqm.produce.spi.SqmCreationOptions; +import org.hibernate.query.sqm.spi.SqmCreationOptions; /** * @author Steve Ebersole diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/produce/internal/SqmCreationProcessingStateImpl.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/internal/SqmCreationProcessingStateImpl.java similarity index 87% rename from hibernate-core/src/main/java/org/hibernate/query/sqm/produce/internal/SqmCreationProcessingStateImpl.java rename to hibernate-core/src/main/java/org/hibernate/query/sqm/internal/SqmCreationProcessingStateImpl.java index a31c2a1520..d9b5e2e04c 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/produce/internal/SqmCreationProcessingStateImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/internal/SqmCreationProcessingStateImpl.java @@ -4,12 +4,12 @@ * 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 */ -package org.hibernate.query.sqm.produce.internal; +package org.hibernate.query.sqm.internal; import org.hibernate.query.hql.internal.SqmPathRegistryImpl; -import org.hibernate.query.sqm.produce.spi.SqmCreationProcessingState; +import org.hibernate.query.sqm.spi.SqmCreationProcessingState; import org.hibernate.query.hql.spi.SqmPathRegistry; -import org.hibernate.query.sqm.produce.spi.SqmCreationState; +import org.hibernate.query.sqm.spi.SqmCreationState; import org.hibernate.query.sqm.tree.SqmQuery; /** diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/produce/internal/SqmDmlCreationProcessingState.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/internal/SqmDmlCreationProcessingState.java similarity index 84% rename from hibernate-core/src/main/java/org/hibernate/query/sqm/produce/internal/SqmDmlCreationProcessingState.java rename to hibernate-core/src/main/java/org/hibernate/query/sqm/internal/SqmDmlCreationProcessingState.java index 88bee67f8e..18618c52cf 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/produce/internal/SqmDmlCreationProcessingState.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/internal/SqmDmlCreationProcessingState.java @@ -4,9 +4,9 @@ * 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 */ -package org.hibernate.query.sqm.produce.internal; +package org.hibernate.query.sqm.internal; -import org.hibernate.query.sqm.produce.spi.SqmCreationState; +import org.hibernate.query.sqm.spi.SqmCreationState; import org.hibernate.query.sqm.tree.SqmQuery; /** diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/produce/internal/SqmQuerySpecCreationProcessingStateStandardImpl.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/internal/SqmQuerySpecCreationProcessingStateStandardImpl.java similarity index 85% rename from hibernate-core/src/main/java/org/hibernate/query/sqm/produce/internal/SqmQuerySpecCreationProcessingStateStandardImpl.java rename to hibernate-core/src/main/java/org/hibernate/query/sqm/internal/SqmQuerySpecCreationProcessingStateStandardImpl.java index 0a3d062abe..786cb67ebe 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/produce/internal/SqmQuerySpecCreationProcessingStateStandardImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/internal/SqmQuerySpecCreationProcessingStateStandardImpl.java @@ -4,11 +4,11 @@ * 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 */ -package org.hibernate.query.sqm.produce.internal; +package org.hibernate.query.sqm.internal; -import org.hibernate.query.sqm.produce.spi.SqmCreationProcessingState; -import org.hibernate.query.sqm.produce.spi.SqmQuerySpecCreationProcessingState; -import org.hibernate.query.sqm.produce.spi.SqmCreationState; +import org.hibernate.query.sqm.spi.SqmCreationProcessingState; +import org.hibernate.query.sqm.spi.SqmQuerySpecCreationProcessingState; +import org.hibernate.query.sqm.spi.SqmCreationState; import org.hibernate.query.sqm.tree.select.SqmSelectQuery; import org.hibernate.query.sqm.tree.select.SqmSelection; diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/produce/internal/SqmTreePrinter.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/internal/SqmTreePrinter.java similarity index 99% rename from hibernate-core/src/main/java/org/hibernate/query/sqm/produce/internal/SqmTreePrinter.java rename to hibernate-core/src/main/java/org/hibernate/query/sqm/internal/SqmTreePrinter.java index bb4ad9f800..99c992dc0b 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/produce/internal/SqmTreePrinter.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/internal/SqmTreePrinter.java @@ -4,13 +4,13 @@ * 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 */ -package org.hibernate.query.sqm.produce.internal; +package org.hibernate.query.sqm.internal; import java.util.Locale; import org.hibernate.NotYetImplementedFor6Exception; import org.hibernate.query.QueryLogger; -import org.hibernate.query.sqm.consume.spi.SemanticQueryWalker; +import org.hibernate.query.sqm.spi.SemanticQueryWalker; import org.hibernate.query.sqm.tree.SqmStatement; import org.hibernate.query.sqm.tree.delete.SqmDeleteStatement; import org.hibernate.query.sqm.tree.domain.SqmBasicValuedSimplePath; diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/produce/function/internal/SelfRenderingSqmFunction.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/produce/function/internal/SelfRenderingSqmFunction.java index 36afdd0439..ee06b110bc 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/produce/function/internal/SelfRenderingSqmFunction.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/produce/function/internal/SelfRenderingSqmFunction.java @@ -10,15 +10,17 @@ import java.util.List; import org.hibernate.metamodel.model.domain.AllowableFunctionReturnType; import org.hibernate.query.sqm.NodeBuilder; +import org.hibernate.query.sqm.function.SqmFunction; import org.hibernate.query.sqm.produce.function.spi.SelfRenderingFunctionSupport; import org.hibernate.query.sqm.tree.SqmTypedNode; import org.hibernate.query.sqm.tree.expression.AbstractSqmExpression; -import org.hibernate.query.sqm.function.SqmFunction; /** * @author Steve Ebersole */ -public class SelfRenderingSqmFunction extends AbstractSqmExpression implements SqmFunction { +public class SelfRenderingSqmFunction + extends AbstractSqmExpression + implements SqmFunction { private final String name; private final SelfRenderingFunctionSupport renderingSupport; private final List> arguments; diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/produce/spi/ImplicitAliasGenerator.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/produce/spi/ImplicitAliasGenerator.java deleted file mode 100644 index 6b598ebd0f..0000000000 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/produce/spi/ImplicitAliasGenerator.java +++ /dev/null @@ -1,35 +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 - */ -package org.hibernate.query.sqm.produce.spi; - -/** - * Handles generating implicit (or synthetic) aliases. - * - * @author Steve Ebersole - */ -public class ImplicitAliasGenerator { - private int unAliasedCount = 0; - - /** - * Builds a unique implicit alias. - * - * @return The generated alias. - */ - public synchronized String generateUniqueImplicitAlias() { - return ""; - } - - /** - * Determine if the given alias is implicit. - * - * @param alias The alias to check - * @return True/false. - */ - public static boolean isImplicitAlias(String alias) { - return alias == null || ( alias.startsWith( "" ) ); - } -} diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/consume/spi/BaseSemanticQueryWalker.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/spi/BaseSemanticQueryWalker.java similarity index 61% rename from hibernate-core/src/main/java/org/hibernate/query/sqm/consume/spi/BaseSemanticQueryWalker.java rename to hibernate-core/src/main/java/org/hibernate/query/sqm/spi/BaseSemanticQueryWalker.java index 7d260fd207..aa445f441f 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/consume/spi/BaseSemanticQueryWalker.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/spi/BaseSemanticQueryWalker.java @@ -4,9 +4,15 @@ * 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 */ -package org.hibernate.query.sqm.consume.spi; +package org.hibernate.query.sqm.spi; import org.hibernate.NotYetImplementedFor6Exception; +import org.hibernate.query.sqm.function.SqmCastTarget; +import org.hibernate.query.sqm.function.SqmDistinct; +import org.hibernate.query.sqm.function.SqmExtractUnit; +import org.hibernate.query.sqm.function.SqmFunction; +import org.hibernate.query.sqm.function.SqmStar; +import org.hibernate.query.sqm.function.SqmTrimSpecification; import org.hibernate.query.sqm.tree.delete.SqmDeleteStatement; import org.hibernate.query.sqm.tree.domain.SqmBasicValuedSimplePath; import org.hibernate.query.sqm.tree.domain.SqmCorrelation; @@ -37,17 +43,10 @@ import org.hibernate.query.sqm.tree.expression.SqmPositionalParameter; import org.hibernate.query.sqm.tree.expression.SqmRestrictedSubQueryExpression; import org.hibernate.query.sqm.tree.expression.SqmTuple; import org.hibernate.query.sqm.tree.expression.SqmUnaryOperation; -import org.hibernate.query.sqm.function.SqmCastTarget; -import org.hibernate.query.sqm.function.SqmDistinct; -import org.hibernate.query.sqm.function.SqmExtractUnit; -import org.hibernate.query.sqm.function.SqmFunction; -import org.hibernate.query.sqm.function.SqmStar; -import org.hibernate.query.sqm.function.SqmTrimSpecification; import org.hibernate.query.sqm.tree.from.SqmAttributeJoin; import org.hibernate.query.sqm.tree.from.SqmCrossJoin; import org.hibernate.query.sqm.tree.from.SqmEntityJoin; import org.hibernate.query.sqm.tree.from.SqmFromClause; -import org.hibernate.query.sqm.tree.from.SqmJoin; import org.hibernate.query.sqm.tree.from.SqmRoot; import org.hibernate.query.sqm.tree.insert.SqmInsertSelectStatement; import org.hibernate.query.sqm.tree.predicate.SqmAndPredicate; @@ -80,10 +79,11 @@ import org.hibernate.query.sqm.tree.update.SqmUpdateStatement; import org.hibernate.service.ServiceRegistry; /** + * Base support for an SQM walker + * * @author Steve Ebersole */ -@SuppressWarnings("unchecked") -public class BaseSemanticQueryWalker implements SemanticQueryWalker { +public class BaseSemanticQueryWalker implements SemanticQueryWalker { private final ServiceRegistry serviceRegistry; public BaseSemanticQueryWalker(ServiceRegistry serviceRegistry) { @@ -95,145 +95,145 @@ public class BaseSemanticQueryWalker implements SemanticQueryWalker { } @Override - public T visitSelectStatement(SqmSelectStatement statement) { + public Object visitSelectStatement(SqmSelectStatement statement) { visitQuerySpec( statement.getQuerySpec() ); - return (T) statement; + return statement; } @Override - public T visitUpdateStatement(SqmUpdateStatement statement) { + public Object visitUpdateStatement(SqmUpdateStatement statement) { visitRootPath( statement.getTarget() ); visitSetClause( statement.getSetClause() ); visitWhereClause( statement.getWhereClause() ); - return (T) statement; + return statement; } @Override - public T visitSetClause(SqmSetClause setClause) { + public Object visitSetClause(SqmSetClause setClause) { for ( SqmAssignment assignment : setClause.getAssignments() ) { visitAssignment( assignment ); } - return (T) setClause; + return setClause; } @Override - public T visitAssignment(SqmAssignment assignment) { + public Object visitAssignment(SqmAssignment assignment) { assignment.getTargetPath().accept( this ); assignment.getValue().accept( this ); - return (T) assignment; + return assignment; } @Override - public T visitInsertSelectStatement(SqmInsertSelectStatement statement) { + public Object visitInsertSelectStatement(SqmInsertSelectStatement statement) { visitRootPath( statement.getTarget() ); for ( SqmPath stateField : statement.getInsertionTargetPaths() ) { stateField.accept( this ); } visitQuerySpec( statement.getSelectQuerySpec() ); - return (T) statement; + return statement; } @Override - public T visitDeleteStatement(SqmDeleteStatement statement) { + public Object visitDeleteStatement(SqmDeleteStatement statement) { visitRootPath( statement.getTarget() ); visitWhereClause( statement.getWhereClause() ); - return (T) statement; + return statement; } @Override - public T visitQuerySpec(SqmQuerySpec querySpec) { + public Object visitQuerySpec(SqmQuerySpec querySpec) { visitFromClause( querySpec.getFromClause() ); visitSelectClause( querySpec.getSelectClause() ); visitWhereClause( querySpec.getWhereClause() ); visitOrderByClause( querySpec.getOrderByClause() ); visitOffsetExpression( querySpec.getOffsetExpression() ); visitLimitExpression( querySpec.getLimitExpression() ); - return (T) querySpec; + return querySpec; } @Override - public T visitFromClause(SqmFromClause fromClause) { + public Object visitFromClause(SqmFromClause fromClause) { fromClause.visitRoots( this::visitRootPath ); - return (T) fromClause; + return fromClause; } @Override - public T visitRootPath(SqmRoot sqmRoot) { - sqmRoot.visitSqmJoins( sqmJoin -> ( (SqmJoin) sqmJoin ).accept( this ) ); - return (T) sqmRoot; + public Object visitRootPath(SqmRoot sqmRoot) { + sqmRoot.visitSqmJoins( sqmJoin -> sqmJoin.accept( this ) ); + return sqmRoot; } @Override - public T visitCrossJoin(SqmCrossJoin joinedFromElement) { + public Object visitCrossJoin(SqmCrossJoin joinedFromElement) { joinedFromElement.visitSqmJoins( sqmJoin -> sqmJoin.accept( this ) ); - return (T) joinedFromElement; + return joinedFromElement; } @Override - public T visitQualifiedEntityJoin(SqmEntityJoin joinedFromElement) { + public Object visitQualifiedEntityJoin(SqmEntityJoin joinedFromElement) { joinedFromElement.visitSqmJoins( sqmJoin -> sqmJoin.accept( this ) ); - return (T) joinedFromElement; + return joinedFromElement; } @Override - public T visitQualifiedAttributeJoin(SqmAttributeJoin joinedFromElement) { + public Object visitQualifiedAttributeJoin(SqmAttributeJoin joinedFromElement) { joinedFromElement.visitSqmJoins( sqmJoin -> sqmJoin.accept( this ) ); - return (T) joinedFromElement; + return joinedFromElement; } @Override - public T visitBasicValuedPath(SqmBasicValuedSimplePath path) { - return (T) path; + public Object visitBasicValuedPath(SqmBasicValuedSimplePath path) { + return path; } @Override - public T visitEmbeddableValuedPath(SqmEmbeddedValuedSimplePath path) { - return (T) path; + public Object visitEmbeddableValuedPath(SqmEmbeddedValuedSimplePath path) { + return path; } @Override - public T visitEntityValuedPath(SqmEntityValuedSimplePath path) { - return (T) path; + public Object visitEntityValuedPath(SqmEntityValuedSimplePath path) { + return path; } @Override - public T visitPluralValuedPath(SqmPluralValuedSimplePath path) { - return (T) path; + public Object visitPluralValuedPath(SqmPluralValuedSimplePath path) { + return path; } @Override - public T visitIndexedPluralAccessPath(SqmIndexedCollectionAccessPath path) { - return (T) path; + public Object visitIndexedPluralAccessPath(SqmIndexedCollectionAccessPath path) { + return path; } @Override - public T visitMaxElementPath(SqmMaxElementPath path) { - return (T) path; + public Object visitMaxElementPath(SqmMaxElementPath path) { + return path; } @Override - public T visitMinElementPath(SqmMinElementPath path) { - return (T) path; + public Object visitMinElementPath(SqmMinElementPath path) { + return path; } @Override - public T visitMaxIndexPath(SqmMaxIndexPath path) { - return (T) path; + public Object visitMaxIndexPath(SqmMaxIndexPath path) { + return path; } @Override - public T visitMinIndexPath(SqmMinIndexPath path) { - return (T) path; + public Object visitMinIndexPath(SqmMinIndexPath path) { + return path; } @Override - public T visitCorrelation(SqmCorrelation correlation) { - return (T) correlation; + public Object visitCorrelation(SqmCorrelation correlation) { + return correlation; } @Override - public T visitSelectClause(SqmSelectClause selectClause) { + public Object visitSelectClause(SqmSelectClause selectClause) { for ( SqmSelection selection : selectClause.getSelections() ) { // todo (6.0) : add the ability for certain SqlSelections to be sort of "implicit"... // - they do not get rendered into the SQL, but do have a SqlReader @@ -244,116 +244,116 @@ public class BaseSemanticQueryWalker implements SemanticQueryWalker { // 2) `EmptySqlSelection` : if this ends up being important at all.. visitSelection( selection ); } - return (T) selectClause; + return selectClause; } @Override - public T visitSelection(SqmSelection selection) { + public Object visitSelection(SqmSelection selection) { selection.getSelectableNode().accept( this ); - return (T) selection; + return selection; } @Override - public T visitWhereClause(SqmWhereClause whereClause) { + public Object visitWhereClause(SqmWhereClause whereClause) { if ( whereClause == null ) { return null; } whereClause.getPredicate().accept( this ); - return (T) whereClause; + return whereClause; } @Override - public T visitGroupedPredicate(SqmGroupedPredicate predicate) { + public Object visitGroupedPredicate(SqmGroupedPredicate predicate) { predicate.getSubPredicate().accept( this ); - return (T) predicate; + return predicate; } @Override - public T visitAndPredicate(SqmAndPredicate predicate) { + public Object visitAndPredicate(SqmAndPredicate predicate) { predicate.getLeftHandPredicate().accept( this ); predicate.getRightHandPredicate().accept( this ); - return (T) predicate; + return predicate; } @Override - public T visitOrPredicate(SqmOrPredicate predicate) { + public Object visitOrPredicate(SqmOrPredicate predicate) { predicate.getLeftHandPredicate().accept( this ); predicate.getRightHandPredicate().accept( this ); - return (T) predicate; + return predicate; } @Override - public T visitComparisonPredicate(SqmComparisonPredicate predicate) { + public Object visitComparisonPredicate(SqmComparisonPredicate predicate) { predicate.getLeftHandExpression().accept( this ); predicate.getRightHandExpression().accept( this ); - return (T) predicate; + return predicate; } @Override - public T visitIsEmptyPredicate(SqmEmptinessPredicate predicate) { + public Object visitIsEmptyPredicate(SqmEmptinessPredicate predicate) { predicate.getPluralPath().accept( this ); - return (T) predicate; + return predicate; } @Override - public T visitIsNullPredicate(SqmNullnessPredicate predicate) { + public Object visitIsNullPredicate(SqmNullnessPredicate predicate) { predicate.getExpression().accept( this ); - return (T) predicate; + return predicate; } @Override - public T visitBetweenPredicate(SqmBetweenPredicate predicate) { + public Object visitBetweenPredicate(SqmBetweenPredicate predicate) { predicate.getExpression().accept( this ); predicate.getLowerBound().accept( this ); predicate.getUpperBound().accept( this ); - return (T) predicate; + return predicate; } @Override - public T visitLikePredicate(SqmLikePredicate predicate) { + public Object visitLikePredicate(SqmLikePredicate predicate) { predicate.getMatchExpression().accept( this ); predicate.getPattern().accept( this ); predicate.getEscapeCharacter().accept( this ); - return (T) predicate; + return predicate; } @Override - public T visitMemberOfPredicate(SqmMemberOfPredicate predicate) { + public Object visitMemberOfPredicate(SqmMemberOfPredicate predicate) { predicate.getPluralPath().accept( this ); - return (T) predicate; + return predicate; } @Override - public T visitNegatedPredicate(SqmNegatedPredicate predicate) { + public Object visitNegatedPredicate(SqmNegatedPredicate predicate) { predicate.getWrappedPredicate().accept( this ); - return (T) predicate; + return predicate; } @Override - public T visitInListPredicate(SqmInListPredicate predicate) { + public Object visitInListPredicate(SqmInListPredicate predicate) { predicate.getTestExpression().accept( this ); for ( SqmExpression expression : predicate.getListExpressions() ) { expression.accept( this ); } - return (T) predicate; + return predicate; } @Override - public T visitInSubQueryPredicate(SqmInSubQueryPredicate predicate) { + public Object visitInSubQueryPredicate(SqmInSubQueryPredicate predicate) { predicate.getTestExpression().accept( this ); predicate.getSubQueryExpression().accept( this ); - return (T) predicate; + return predicate; } @Override - public T visitBooleanExpressionPredicate(SqmBooleanExpressionPredicate predicate) { + public Object visitBooleanExpressionPredicate(SqmBooleanExpressionPredicate predicate) { predicate.getBooleanExpression().accept( this ); - return (T) predicate; + return predicate; } @Override - public T visitOrderByClause(SqmOrderByClause orderByClause) { + public Object visitOrderByClause(SqmOrderByClause orderByClause) { if ( orderByClause == null ) { return null; } @@ -363,17 +363,17 @@ public class BaseSemanticQueryWalker implements SemanticQueryWalker { visitSortSpecification( sortSpecification ); } } - return (T) orderByClause; + return orderByClause; } @Override - public T visitSortSpecification(SqmSortSpecification sortSpecification) { + public Object visitSortSpecification(SqmSortSpecification sortSpecification) { sortSpecification.getSortExpression().accept( this ); - return (T) sortSpecification; + return sortSpecification; } @Override - public T visitOffsetExpression(SqmExpression expression) { + public Object visitOffsetExpression(SqmExpression expression) { if ( expression == null ) { return null; } @@ -382,25 +382,25 @@ public class BaseSemanticQueryWalker implements SemanticQueryWalker { } @Override - public T visitGroupByClause(SqmGroupByClause clause) { + public Object visitGroupByClause(SqmGroupByClause clause) { clause.visitGroupings( this::visitGrouping ); - return (T) clause; + return clause; } @Override - public T visitGrouping(SqmGroupByClause.SqmGrouping grouping) { + public Object visitGrouping(SqmGroupByClause.SqmGrouping grouping) { grouping.getExpression().accept( this ); - return (T) grouping; + return grouping; } @Override - public T visitHavingClause(SqmHavingClause clause) { + public Object visitHavingClause(SqmHavingClause clause) { clause.getPredicate().accept( this ); - return (T) clause; + return clause; } @Override - public T visitLimitExpression(SqmExpression expression) { + public Object visitLimitExpression(SqmExpression expression) { if ( expression == null ) { return null; } @@ -409,69 +409,69 @@ public class BaseSemanticQueryWalker implements SemanticQueryWalker { } @Override - public T visitPositionalParameterExpression(SqmPositionalParameter expression) { - return (T) expression; + public Object visitPositionalParameterExpression(SqmPositionalParameter expression) { + return expression; } @Override - public T visitNamedParameterExpression(SqmNamedParameter expression) { - return (T) expression; + public Object visitNamedParameterExpression(SqmNamedParameter expression) { + return expression; } @Override - public T visitCriteriaParameter(SqmCriteriaParameter expression) { - return (T) expression; + public Object visitCriteriaParameter(SqmCriteriaParameter expression) { + return expression; } @Override - public T visitEntityTypeLiteralExpression(SqmLiteralEntityType expression) { - return (T) expression; + public Object visitEntityTypeLiteralExpression(SqmLiteralEntityType expression) { + return expression; } @Override - public T visitParameterizedEntityTypeExpression(SqmEntityType expression) { - return (T) expression; + public Object visitParameterizedEntityTypeExpression(SqmEntityType expression) { + return expression; } @Override - public T visitUnaryOperationExpression(SqmUnaryOperation sqmExpression) { + public Object visitUnaryOperationExpression(SqmUnaryOperation sqmExpression) { sqmExpression.getOperand().accept( this ); - return (T) sqmExpression; + return sqmExpression; } @Override - public T visitFunction(SqmFunction sqmFunction) { - return (T) sqmFunction; + public Object visitFunction(SqmFunction sqmFunction) { + return sqmFunction; } @Override - public T visitRestrictedSubQueryExpression(SqmRestrictedSubQueryExpression sqmRestrictedSubQueryExpression) { + public Object visitRestrictedSubQueryExpression(SqmRestrictedSubQueryExpression sqmRestrictedSubQueryExpression) { return sqmRestrictedSubQueryExpression.getSubQuery().accept( this ); } @Override - public T visitExtractUnit(SqmExtractUnit extractUnit) { - return (T) extractUnit; + public Object visitExtractUnit(SqmExtractUnit extractUnit) { + return extractUnit; } @Override - public T visitCastTarget(SqmCastTarget castTarget) { - return (T) castTarget; + public Object visitCastTarget(SqmCastTarget castTarget) { + return castTarget; } @Override - public T visitTrimSpecification(SqmTrimSpecification trimSpecification) { - return (T) trimSpecification; + public Object visitTrimSpecification(SqmTrimSpecification trimSpecification) { + return trimSpecification; } @Override - public T visitDistinct(SqmDistinct distinct) { - return (T) distinct; + public Object visitDistinct(SqmDistinct distinct) { + return distinct; } @Override - public T visitStar(SqmStar sqmStar) { - return (T) sqmStar; + public Object visitStar(SqmStar sqmStar) { + return sqmStar; } // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -479,68 +479,68 @@ public class BaseSemanticQueryWalker implements SemanticQueryWalker { @Override - public T visitTreatedPath(SqmTreatedPath sqmTreatedPath) { + public Object visitTreatedPath(SqmTreatedPath sqmTreatedPath) { throw new NotYetImplementedFor6Exception(); } @Override - public T visitPluralAttributeSizeFunction(SqmCollectionSize function) { - return (T) function; + public Object visitPluralAttributeSizeFunction(SqmCollectionSize function) { + return function; } @Override - public T visitMapEntryFunction(SqmMapEntryReference binding) { - return (T) binding; + public Object visitMapEntryFunction(SqmMapEntryReference binding) { + return binding; } @Override - public T visitLiteral(SqmLiteral literal) { - return (T) literal; + public Object visitLiteral(SqmLiteral literal) { + return literal; } @Override - public T visitTuple(SqmTuple sqmTuple) { - return (T) sqmTuple; + public Object visitTuple(SqmTuple sqmTuple) { + return sqmTuple; } @Override - public T visitBinaryArithmeticExpression(SqmBinaryArithmetic expression) { - return (T) expression; + public Object visitBinaryArithmeticExpression(SqmBinaryArithmetic expression) { + return expression; } @Override - public T visitSubQueryExpression(SqmSubQuery expression) { - return (T) expression; + public Object visitSubQueryExpression(SqmSubQuery expression) { + return expression; } @Override - public T visitSimpleCaseExpression(SqmCaseSimple expression) { - return (T) expression; + public Object visitSimpleCaseExpression(SqmCaseSimple expression) { + return expression; } @Override - public T visitSearchedCaseExpression(SqmCaseSearched expression) { - return (T) expression; + public Object visitSearchedCaseExpression(SqmCaseSearched expression) { + return expression; } @Override - public T visitDynamicInstantiation(SqmDynamicInstantiation sqmDynamicInstantiation) { - return (T) sqmDynamicInstantiation; + public Object visitDynamicInstantiation(SqmDynamicInstantiation sqmDynamicInstantiation) { + return sqmDynamicInstantiation; } @Override - public T visitFullyQualifiedClass(Class namedClass) { + public Object visitFullyQualifiedClass(Class namedClass) { throw new UnsupportedOperationException( "Not supported" ); } @Override - public T visitEnumLiteral(SqmEnumLiteral sqmEnumLiteral) { + public Object visitEnumLiteral(SqmEnumLiteral sqmEnumLiteral) { throw new UnsupportedOperationException( "Not supported" ); } @Override - public T visitFieldLiteral(SqmFieldLiteral sqmFieldLiteral) { + public Object visitFieldLiteral(SqmFieldLiteral sqmFieldLiteral) { throw new UnsupportedOperationException( "Not supported" ); } diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/consume/spi/FromClauseIndex.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/spi/FromClauseIndex.java similarity index 98% rename from hibernate-core/src/main/java/org/hibernate/query/sqm/consume/spi/FromClauseIndex.java rename to hibernate-core/src/main/java/org/hibernate/query/sqm/spi/FromClauseIndex.java index 4290864efc..f7305a377b 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/consume/spi/FromClauseIndex.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/spi/FromClauseIndex.java @@ -5,7 +5,7 @@ * See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html */ -package org.hibernate.query.sqm.consume.spi; +package org.hibernate.query.sqm.spi; import java.util.HashMap; import java.util.HashSet; diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/consume/spi/JdbcParameterBySqmParameterAccess.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/spi/JdbcParameterBySqmParameterAccess.java similarity index 94% rename from hibernate-core/src/main/java/org/hibernate/query/sqm/consume/spi/JdbcParameterBySqmParameterAccess.java rename to hibernate-core/src/main/java/org/hibernate/query/sqm/spi/JdbcParameterBySqmParameterAccess.java index 6de2c69d45..40cef4dc4c 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/consume/spi/JdbcParameterBySqmParameterAccess.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/spi/JdbcParameterBySqmParameterAccess.java @@ -4,7 +4,7 @@ * 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 */ -package org.hibernate.query.sqm.consume.spi; +package org.hibernate.query.sqm.spi; import java.util.List; import java.util.Map; diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/produce/spi/ParameterDeclarationContext.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/spi/ParameterDeclarationContext.java similarity index 94% rename from hibernate-core/src/main/java/org/hibernate/query/sqm/produce/spi/ParameterDeclarationContext.java rename to hibernate-core/src/main/java/org/hibernate/query/sqm/spi/ParameterDeclarationContext.java index e4760710e6..b6de7fd3bd 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/produce/spi/ParameterDeclarationContext.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/spi/ParameterDeclarationContext.java @@ -4,7 +4,7 @@ * 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 */ -package org.hibernate.query.sqm.produce.spi; +package org.hibernate.query.sqm.spi; import org.hibernate.query.sqm.tree.expression.SqmParameter; diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/consume/spi/SemanticQueryWalker.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/spi/SemanticQueryWalker.java similarity index 99% rename from hibernate-core/src/main/java/org/hibernate/query/sqm/consume/spi/SemanticQueryWalker.java rename to hibernate-core/src/main/java/org/hibernate/query/sqm/spi/SemanticQueryWalker.java index 81da3f3a79..887301f938 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/consume/spi/SemanticQueryWalker.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/spi/SemanticQueryWalker.java @@ -4,7 +4,7 @@ * 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 */ -package org.hibernate.query.sqm.consume.spi; +package org.hibernate.query.sqm.spi; import org.hibernate.NotYetImplementedFor6Exception; import org.hibernate.query.sqm.tree.delete.SqmDeleteStatement; @@ -78,6 +78,8 @@ import org.hibernate.query.sqm.tree.update.SqmSetClause; import org.hibernate.query.sqm.tree.update.SqmUpdateStatement; /** + * Support for walking a Semantic Query Model (SQM) tree + * * @author Steve Ebersole */ public interface SemanticQueryWalker { diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/produce/spi/SqmCreationContext.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/spi/SqmCreationContext.java similarity index 95% rename from hibernate-core/src/main/java/org/hibernate/query/sqm/produce/spi/SqmCreationContext.java rename to hibernate-core/src/main/java/org/hibernate/query/sqm/spi/SqmCreationContext.java index 476a278d4c..f6628dea45 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/produce/spi/SqmCreationContext.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/spi/SqmCreationContext.java @@ -4,7 +4,7 @@ * 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 */ -package org.hibernate.query.sqm.produce.spi; +package org.hibernate.query.sqm.spi; import org.hibernate.Incubating; import org.hibernate.metamodel.model.domain.JpaMetamodel; diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/produce/SqmCreationHelper.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/spi/SqmCreationHelper.java similarity index 96% rename from hibernate-core/src/main/java/org/hibernate/query/sqm/produce/SqmCreationHelper.java rename to hibernate-core/src/main/java/org/hibernate/query/sqm/spi/SqmCreationHelper.java index 9b4b66f874..df577cbabc 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/produce/SqmCreationHelper.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/spi/SqmCreationHelper.java @@ -4,7 +4,7 @@ * 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 */ -package org.hibernate.query.sqm.produce; +package org.hibernate.query.sqm.spi; import org.hibernate.query.NavigablePath; import org.hibernate.query.sqm.tree.domain.SqmPath; diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/produce/spi/SqmCreationOptions.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/spi/SqmCreationOptions.java similarity index 94% rename from hibernate-core/src/main/java/org/hibernate/query/sqm/produce/spi/SqmCreationOptions.java rename to hibernate-core/src/main/java/org/hibernate/query/sqm/spi/SqmCreationOptions.java index fbf488ab3f..00e3647bc6 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/produce/spi/SqmCreationOptions.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/spi/SqmCreationOptions.java @@ -4,7 +4,7 @@ * 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 */ -package org.hibernate.query.sqm.produce.spi; +package org.hibernate.query.sqm.spi; import org.hibernate.Incubating; import org.hibernate.query.sqm.StrictJpaComplianceViolation; diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/produce/spi/SqmCreationProcessingState.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/spi/SqmCreationProcessingState.java similarity index 96% rename from hibernate-core/src/main/java/org/hibernate/query/sqm/produce/spi/SqmCreationProcessingState.java rename to hibernate-core/src/main/java/org/hibernate/query/sqm/spi/SqmCreationProcessingState.java index d36a667367..25a0458483 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/produce/spi/SqmCreationProcessingState.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/spi/SqmCreationProcessingState.java @@ -4,7 +4,7 @@ * 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 */ -package org.hibernate.query.sqm.produce.spi; +package org.hibernate.query.sqm.spi; import org.hibernate.Incubating; import org.hibernate.query.hql.spi.SqmPathRegistry; diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/produce/spi/SqmCreationState.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/spi/SqmCreationState.java similarity index 96% rename from hibernate-core/src/main/java/org/hibernate/query/sqm/produce/spi/SqmCreationState.java rename to hibernate-core/src/main/java/org/hibernate/query/sqm/spi/SqmCreationState.java index 62b3e5d7c2..16ddefd1d1 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/produce/spi/SqmCreationState.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/spi/SqmCreationState.java @@ -4,7 +4,7 @@ * 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 */ -package org.hibernate.query.sqm.produce.spi; +package org.hibernate.query.sqm.spi; import org.hibernate.Incubating; import org.hibernate.internal.util.collections.Stack; diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/produce/spi/SqmQuerySpecCreationProcessingState.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/spi/SqmQuerySpecCreationProcessingState.java similarity index 94% rename from hibernate-core/src/main/java/org/hibernate/query/sqm/produce/spi/SqmQuerySpecCreationProcessingState.java rename to hibernate-core/src/main/java/org/hibernate/query/sqm/spi/SqmQuerySpecCreationProcessingState.java index 0eafefca95..4766e38120 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/produce/spi/SqmQuerySpecCreationProcessingState.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/spi/SqmQuerySpecCreationProcessingState.java @@ -4,7 +4,7 @@ * 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 */ -package org.hibernate.query.sqm.produce.spi; +package org.hibernate.query.sqm.spi; import org.hibernate.Incubating; import org.hibernate.query.sqm.tree.select.SqmSelectQuery; diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/consume/spi/SqmToSqlAstConverter.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/spi/SqmToSqlAstConverter.java similarity index 69% rename from hibernate-core/src/main/java/org/hibernate/query/sqm/consume/spi/SqmToSqlAstConverter.java rename to hibernate-core/src/main/java/org/hibernate/query/sqm/spi/SqmToSqlAstConverter.java index 9f3041726e..003fb6204b 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/consume/spi/SqmToSqlAstConverter.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/spi/SqmToSqlAstConverter.java @@ -4,7 +4,7 @@ * 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 */ -package org.hibernate.query.sqm.consume.spi; +package org.hibernate.query.sqm.spi; import org.hibernate.sql.ast.spi.SqlAstCreationState; @@ -13,6 +13,5 @@ import org.hibernate.sql.ast.spi.SqlAstCreationState; * * @author Steve Ebersole */ -@SuppressWarnings("WeakerAccess") -public interface SqmToSqlAstConverter extends SemanticQueryWalker, SqlAstCreationState { +public interface SqmToSqlAstConverter extends SemanticQueryWalker, SqlAstCreationState { } diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/produce/SqmTreeCreationLogger.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/spi/SqmTreeCreationLogger.java similarity index 94% rename from hibernate-core/src/main/java/org/hibernate/query/sqm/produce/SqmTreeCreationLogger.java rename to hibernate-core/src/main/java/org/hibernate/query/sqm/spi/SqmTreeCreationLogger.java index 900ae84a7b..3b44db71a8 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/produce/SqmTreeCreationLogger.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/spi/SqmTreeCreationLogger.java @@ -4,7 +4,7 @@ * 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 */ -package org.hibernate.query.sqm.produce; +package org.hibernate.query.sqm.spi; import org.hibernate.Internal; import org.hibernate.query.QueryLogger; diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/produce/internal/UniqueIdGenerator.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/spi/package-info.java similarity index 52% rename from hibernate-core/src/main/java/org/hibernate/query/sqm/produce/internal/UniqueIdGenerator.java rename to hibernate-core/src/main/java/org/hibernate/query/sqm/spi/package-info.java index be6367222f..7b7b052b85 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/produce/internal/UniqueIdGenerator.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/spi/package-info.java @@ -4,15 +4,8 @@ * 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 */ -package org.hibernate.query.sqm.produce.internal; /** - * @author Steve Ebersole + * SPI-level SQM contracts */ -public class UniqueIdGenerator { - private long uidSequence = 0; - - public String generateUniqueId() { - return ""; - } -} +package org.hibernate.query.sqm.spi; diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/SqmVisitableNode.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/SqmVisitableNode.java index 46a5bef455..e148578d8a 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/SqmVisitableNode.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/SqmVisitableNode.java @@ -6,7 +6,7 @@ */ package org.hibernate.query.sqm.tree; -import org.hibernate.query.sqm.consume.spi.SemanticQueryWalker; +import org.hibernate.query.sqm.spi.SemanticQueryWalker; /** * Optional contract for SqmNode implementations that can be visited diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/delete/SqmDeleteStatement.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/delete/SqmDeleteStatement.java index be49e4e744..2e26c12ad6 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/delete/SqmDeleteStatement.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/delete/SqmDeleteStatement.java @@ -16,7 +16,7 @@ import org.hibernate.query.criteria.JpaCriteriaDelete; import org.hibernate.query.criteria.JpaPredicate; import org.hibernate.query.sqm.NodeBuilder; import org.hibernate.query.sqm.SqmQuerySource; -import org.hibernate.query.sqm.consume.spi.SemanticQueryWalker; +import org.hibernate.query.sqm.spi.SemanticQueryWalker; import org.hibernate.query.sqm.tree.AbstractSqmDmlStatement; import org.hibernate.query.sqm.tree.SqmDeleteOrUpdateStatement; import org.hibernate.query.sqm.tree.from.SqmRoot; diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/AbstractSqmAttributeJoin.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/AbstractSqmAttributeJoin.java index 0c240161aa..3d86547b0f 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/AbstractSqmAttributeJoin.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/AbstractSqmAttributeJoin.java @@ -16,8 +16,8 @@ import org.hibernate.query.criteria.JpaPredicate; import org.hibernate.query.sqm.NodeBuilder; import org.hibernate.query.sqm.SqmJoinable; import org.hibernate.query.sqm.SqmPathSource; -import org.hibernate.query.sqm.consume.spi.SemanticQueryWalker; -import org.hibernate.query.sqm.produce.SqmCreationHelper; +import org.hibernate.query.sqm.spi.SemanticQueryWalker; +import org.hibernate.query.sqm.spi.SqmCreationHelper; import org.hibernate.query.sqm.tree.SqmJoinType; import org.hibernate.query.sqm.tree.from.SqmAttributeJoin; import org.hibernate.query.sqm.tree.from.SqmFrom; diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/AbstractSqmFrom.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/AbstractSqmFrom.java index 5ca4e7e5e4..cb3a251f30 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/AbstractSqmFrom.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/AbstractSqmFrom.java @@ -40,7 +40,7 @@ import org.hibernate.query.SemanticException; import org.hibernate.query.sqm.SqmPathSource; import org.hibernate.query.sqm.UnknownPathException; import org.hibernate.query.hql.spi.SemanticPathPart; -import org.hibernate.query.sqm.produce.spi.SqmCreationState; +import org.hibernate.query.sqm.spi.SqmCreationState; import org.hibernate.query.sqm.tree.SqmJoinType; import org.hibernate.query.sqm.tree.from.SqmAttributeJoin; import org.hibernate.query.sqm.tree.from.SqmFrom; diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/AbstractSqmPath.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/AbstractSqmPath.java index 6c4808bf10..99205f1038 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/AbstractSqmPath.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/AbstractSqmPath.java @@ -27,7 +27,7 @@ import org.hibernate.query.NavigablePath; import org.hibernate.query.sqm.IllegalPathUsageException; import org.hibernate.query.sqm.NodeBuilder; import org.hibernate.query.sqm.SqmPathSource; -import org.hibernate.query.sqm.produce.spi.SqmCreationState; +import org.hibernate.query.sqm.spi.SqmCreationState; import org.hibernate.query.sqm.tree.expression.AbstractSqmExpression; import org.hibernate.query.sqm.tree.expression.SqmExpression; import org.hibernate.type.descriptor.java.JavaTypeDescriptor; diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/SqmAnyValuedSimplePath.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/SqmAnyValuedSimplePath.java index 2b7c590bcb..32462c41e0 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/SqmAnyValuedSimplePath.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/SqmAnyValuedSimplePath.java @@ -13,9 +13,9 @@ import org.hibernate.query.NavigablePath; import org.hibernate.query.PathException; import org.hibernate.query.sqm.NodeBuilder; import org.hibernate.query.sqm.SqmPathSource; -import org.hibernate.query.sqm.consume.spi.SemanticQueryWalker; +import org.hibernate.query.sqm.spi.SemanticQueryWalker; import org.hibernate.query.hql.spi.SemanticPathPart; -import org.hibernate.query.sqm.produce.spi.SqmCreationState; +import org.hibernate.query.sqm.spi.SqmCreationState; /** * @author Steve Ebersole diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/SqmBagJoin.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/SqmBagJoin.java index 74b5fa2a13..94c669751c 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/SqmBagJoin.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/SqmBagJoin.java @@ -16,13 +16,13 @@ import javax.persistence.metamodel.SingularAttribute; import org.hibernate.NotYetImplementedFor6Exception; import org.hibernate.metamodel.model.domain.BagPersistentAttribute; import org.hibernate.metamodel.model.domain.EntityDomainType; +import org.hibernate.query.PathException; import org.hibernate.query.criteria.JpaCollectionJoin; import org.hibernate.query.criteria.JpaExpression; import org.hibernate.query.criteria.JpaPredicate; import org.hibernate.query.criteria.JpaSubQuery; -import org.hibernate.query.PathException; import org.hibernate.query.sqm.NodeBuilder; -import org.hibernate.query.sqm.produce.spi.SqmCreationProcessingState; +import org.hibernate.query.sqm.spi.SqmCreationProcessingState; import org.hibernate.query.sqm.tree.SqmJoinType; import org.hibernate.query.sqm.tree.from.SqmAttributeJoin; import org.hibernate.query.sqm.tree.from.SqmFrom; @@ -134,6 +134,7 @@ public class SqmBagJoin extends AbstractSqmPluralJoin, E> @Override public SqmAttributeJoin makeCopy(SqmCreationProcessingState creationProcessingState) { + //noinspection unchecked return new SqmBagJoin( creationProcessingState.getPathRegistry().findFromByPath( getLhs().getNavigablePath() ), getReferencedPathSource(), diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/SqmBasicValuedSimplePath.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/SqmBasicValuedSimplePath.java index c4870fc7f1..8ea7b8f518 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/SqmBasicValuedSimplePath.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/SqmBasicValuedSimplePath.java @@ -9,12 +9,12 @@ package org.hibernate.query.sqm.tree.domain; import org.hibernate.metamodel.model.domain.EntityDomainType; import org.hibernate.query.NavigablePath; import org.hibernate.query.PathException; -import org.hibernate.query.sqm.NodeBuilder; import org.hibernate.query.SemanticException; -import org.hibernate.query.sqm.SqmPathSource; -import org.hibernate.query.sqm.consume.spi.SemanticQueryWalker; import org.hibernate.query.hql.spi.SemanticPathPart; -import org.hibernate.query.sqm.produce.spi.SqmCreationState; +import org.hibernate.query.sqm.NodeBuilder; +import org.hibernate.query.sqm.SqmPathSource; +import org.hibernate.query.sqm.spi.SemanticQueryWalker; +import org.hibernate.query.sqm.spi.SqmCreationState; import org.hibernate.type.descriptor.java.BasicJavaDescriptor; /** diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/SqmCorrelatedRoot.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/SqmCorrelatedRoot.java index 39e8501da8..d69e516cbb 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/SqmCorrelatedRoot.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/SqmCorrelatedRoot.java @@ -8,7 +8,7 @@ package org.hibernate.query.sqm.tree.domain; import org.hibernate.query.criteria.JpaSubQuery; import org.hibernate.query.sqm.NodeBuilder; -import org.hibernate.query.sqm.consume.spi.SemanticQueryWalker; +import org.hibernate.query.sqm.spi.SemanticQueryWalker; import org.hibernate.query.sqm.tree.from.SqmFrom; import org.hibernate.query.sqm.tree.from.SqmRoot; import org.hibernate.query.sqm.tree.select.SqmSubQuery; diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/SqmEmbeddedValuedSimplePath.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/SqmEmbeddedValuedSimplePath.java index b9e0dc486b..047f16fb4f 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/SqmEmbeddedValuedSimplePath.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/SqmEmbeddedValuedSimplePath.java @@ -14,8 +14,8 @@ import org.hibernate.query.hql.spi.SemanticPathPart; import org.hibernate.query.sqm.NodeBuilder; import org.hibernate.query.sqm.SqmPathSource; import org.hibernate.query.sqm.UnknownPathException; -import org.hibernate.query.sqm.consume.spi.SemanticQueryWalker; -import org.hibernate.query.sqm.produce.spi.SqmCreationState; +import org.hibernate.query.sqm.spi.SemanticQueryWalker; +import org.hibernate.query.sqm.spi.SqmCreationState; /** * @author Steve Ebersole diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/SqmEntityValuedSimplePath.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/SqmEntityValuedSimplePath.java index 9833415dd4..cd526bfbed 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/SqmEntityValuedSimplePath.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/SqmEntityValuedSimplePath.java @@ -12,8 +12,8 @@ import org.hibernate.query.PathException; import org.hibernate.query.hql.spi.SemanticPathPart; import org.hibernate.query.sqm.NodeBuilder; import org.hibernate.query.sqm.SqmPathSource; -import org.hibernate.query.sqm.consume.spi.SemanticQueryWalker; -import org.hibernate.query.sqm.produce.spi.SqmCreationState; +import org.hibernate.query.sqm.spi.SemanticQueryWalker; +import org.hibernate.query.sqm.spi.SqmCreationState; /** * @author Steve Ebersole diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/SqmIndexedCollectionAccessPath.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/SqmIndexedCollectionAccessPath.java index 55430499a4..ceca9c4655 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/SqmIndexedCollectionAccessPath.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/SqmIndexedCollectionAccessPath.java @@ -6,15 +6,14 @@ */ package org.hibernate.query.sqm.tree.domain; -import org.hibernate.NotYetImplementedFor6Exception; import org.hibernate.metamodel.model.domain.EntityDomainType; import org.hibernate.metamodel.model.domain.PluralPersistentAttribute; import org.hibernate.query.NavigablePath; import org.hibernate.query.PathException; import org.hibernate.query.sqm.SqmPathSource; -import org.hibernate.query.sqm.consume.spi.SemanticQueryWalker; +import org.hibernate.query.sqm.spi.SemanticQueryWalker; import org.hibernate.query.hql.spi.SemanticPathPart; -import org.hibernate.query.sqm.produce.spi.SqmCreationState; +import org.hibernate.query.sqm.spi.SqmCreationState; import org.hibernate.query.sqm.tree.expression.SqmExpression; /** diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/SqmListJoin.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/SqmListJoin.java index d166164440..5216afe98f 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/SqmListJoin.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/SqmListJoin.java @@ -17,13 +17,13 @@ import org.hibernate.NotYetImplementedFor6Exception; import org.hibernate.metamodel.model.domain.EntityDomainType; import org.hibernate.metamodel.model.domain.ListPersistentAttribute; import org.hibernate.query.NavigablePath; +import org.hibernate.query.PathException; import org.hibernate.query.criteria.JpaExpression; import org.hibernate.query.criteria.JpaListJoin; import org.hibernate.query.criteria.JpaPredicate; import org.hibernate.query.criteria.JpaSubQuery; -import org.hibernate.query.PathException; import org.hibernate.query.sqm.NodeBuilder; -import org.hibernate.query.sqm.produce.spi.SqmCreationProcessingState; +import org.hibernate.query.sqm.spi.SqmCreationProcessingState; import org.hibernate.query.sqm.tree.SqmJoinType; import org.hibernate.query.sqm.tree.from.SqmAttributeJoin; import org.hibernate.query.sqm.tree.from.SqmFrom; @@ -32,7 +32,9 @@ import org.hibernate.type.descriptor.java.JavaTypeDescriptor; /** * @author Steve Ebersole */ -public class SqmListJoin extends AbstractSqmPluralJoin, E> implements JpaListJoin { +public class SqmListJoin + extends AbstractSqmPluralJoin, E> + implements JpaListJoin { public SqmListJoin( SqmFrom lhs, ListPersistentAttribute listAttribute, @@ -141,6 +143,7 @@ public class SqmListJoin extends AbstractSqmPluralJoin, E> implem @Override public SqmAttributeJoin makeCopy(SqmCreationProcessingState creationProcessingState) { + //noinspection unchecked return new SqmListJoin( creationProcessingState.getPathRegistry().findFromByPath( getLhs().getNavigablePath() ), getReferencedPathSource(), diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/SqmMapEntryReference.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/SqmMapEntryReference.java index 17c3d183c8..6627f0f920 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/SqmMapEntryReference.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/SqmMapEntryReference.java @@ -18,8 +18,9 @@ import javax.persistence.criteria.Predicate; import org.hibernate.query.criteria.JpaSelection; import org.hibernate.query.sqm.NodeBuilder; import org.hibernate.query.sqm.SqmExpressable; -import org.hibernate.query.sqm.consume.spi.SemanticQueryWalker; +import org.hibernate.query.sqm.spi.SemanticQueryWalker; import org.hibernate.query.sqm.tree.select.SqmSelectableNode; +import org.hibernate.sql.results.spi.DomainResultProducer; import org.hibernate.type.descriptor.java.JavaTypeDescriptor; @@ -30,7 +31,8 @@ import org.hibernate.type.descriptor.java.JavaTypeDescriptor; * @author Gunnar Morling * @author Steve Ebersole */ -public class SqmMapEntryReference implements SqmSelectableNode>, Expression> { +public class SqmMapEntryReference + implements SqmSelectableNode>, Expression>, DomainResultProducer> { @SuppressWarnings({"FieldCanBeLocal", "unused"}) private final SqmPath mapPath; private final NodeBuilder nodeBuilder; @@ -82,6 +84,11 @@ public class SqmMapEntryReference implements SqmSelectableNode> getDomainResultProducer() { + return this; + } + @Override public void visitSubSelectableNodes(Consumer> jpaSelectionConsumer) { } diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/SqmMapJoin.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/SqmMapJoin.java index c6a102ed99..4dcdd94227 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/SqmMapJoin.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/SqmMapJoin.java @@ -16,14 +16,14 @@ import org.hibernate.metamodel.model.domain.EmbeddableDomainType; import org.hibernate.metamodel.model.domain.EntityDomainType; import org.hibernate.metamodel.model.domain.MapPersistentAttribute; import org.hibernate.query.NavigablePath; +import org.hibernate.query.PathException; import org.hibernate.query.criteria.JpaExpression; import org.hibernate.query.criteria.JpaMapJoin; import org.hibernate.query.criteria.JpaPredicate; import org.hibernate.query.criteria.JpaSubQuery; -import org.hibernate.query.PathException; import org.hibernate.query.sqm.NodeBuilder; import org.hibernate.query.sqm.SqmPathSource; -import org.hibernate.query.sqm.produce.spi.SqmCreationProcessingState; +import org.hibernate.query.sqm.spi.SqmCreationProcessingState; import org.hibernate.query.sqm.tree.SqmJoinType; import org.hibernate.query.sqm.tree.from.SqmAttributeJoin; import org.hibernate.query.sqm.tree.from.SqmFrom; @@ -32,7 +32,9 @@ import org.hibernate.type.descriptor.java.JavaTypeDescriptor; /** * @author Steve Ebersole */ -public class SqmMapJoin extends AbstractSqmPluralJoin,V> implements JpaMapJoin { +public class SqmMapJoin + extends AbstractSqmPluralJoin,V> + implements JpaMapJoin { public SqmMapJoin( SqmFrom lhs, MapPersistentAttribute pluralValuedNavigable, diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/SqmMaxElementPath.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/SqmMaxElementPath.java index 8fd88c3c9f..caaa98d31d 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/SqmMaxElementPath.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/SqmMaxElementPath.java @@ -11,8 +11,8 @@ import org.hibernate.metamodel.model.domain.PluralPersistentAttribute; import org.hibernate.query.SemanticException; import org.hibernate.query.hql.spi.SemanticPathPart; import org.hibernate.query.sqm.SqmPathSource; -import org.hibernate.query.sqm.consume.spi.SemanticQueryWalker; -import org.hibernate.query.sqm.produce.spi.SqmCreationState; +import org.hibernate.query.sqm.spi.SemanticQueryWalker; +import org.hibernate.query.sqm.spi.SqmCreationState; /** * @author Steve Ebersole diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/SqmMaxIndexPath.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/SqmMaxIndexPath.java index 28837d7194..554b8eeef4 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/SqmMaxIndexPath.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/SqmMaxIndexPath.java @@ -10,9 +10,9 @@ import org.hibernate.metamodel.model.domain.ListPersistentAttribute; import org.hibernate.metamodel.model.domain.MapPersistentAttribute; import org.hibernate.metamodel.model.domain.PluralPersistentAttribute; import org.hibernate.query.sqm.SqmPathSource; -import org.hibernate.query.sqm.consume.spi.SemanticQueryWalker; +import org.hibernate.query.sqm.spi.SemanticQueryWalker; import org.hibernate.query.hql.spi.SemanticPathPart; -import org.hibernate.query.sqm.produce.spi.SqmCreationState; +import org.hibernate.query.sqm.spi.SqmCreationState; /** * @author Steve Ebersole diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/SqmMinElementPath.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/SqmMinElementPath.java index 656b62f63a..7d4cbf27a3 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/SqmMinElementPath.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/SqmMinElementPath.java @@ -10,9 +10,9 @@ import org.hibernate.metamodel.model.domain.ManagedDomainType; import org.hibernate.metamodel.model.domain.PluralPersistentAttribute; import org.hibernate.query.SemanticException; import org.hibernate.query.sqm.SqmPathSource; -import org.hibernate.query.sqm.consume.spi.SemanticQueryWalker; +import org.hibernate.query.sqm.spi.SemanticQueryWalker; import org.hibernate.query.hql.spi.SemanticPathPart; -import org.hibernate.query.sqm.produce.spi.SqmCreationState; +import org.hibernate.query.sqm.spi.SqmCreationState; /** * @author Steve Ebersole diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/SqmMinIndexPath.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/SqmMinIndexPath.java index c9d9990e6d..1597d79e9a 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/SqmMinIndexPath.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/SqmMinIndexPath.java @@ -10,9 +10,9 @@ import org.hibernate.metamodel.model.domain.ListPersistentAttribute; import org.hibernate.metamodel.model.domain.MapPersistentAttribute; import org.hibernate.metamodel.model.domain.PluralPersistentAttribute; import org.hibernate.query.sqm.SqmPathSource; -import org.hibernate.query.sqm.consume.spi.SemanticQueryWalker; +import org.hibernate.query.sqm.spi.SemanticQueryWalker; import org.hibernate.query.hql.spi.SemanticPathPart; -import org.hibernate.query.sqm.produce.spi.SqmCreationState; +import org.hibernate.query.sqm.spi.SqmCreationState; /** * @author Steve Ebersole diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/SqmPath.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/SqmPath.java index 61e6f7c266..9435b908d0 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/SqmPath.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/SqmPath.java @@ -6,10 +6,8 @@ */ package org.hibernate.query.sqm.tree.domain; -import java.util.ArrayList; import java.util.List; import java.util.function.Consumer; -import java.util.function.Supplier; import org.hibernate.metamodel.model.domain.EntityDomainType; import org.hibernate.query.NavigablePath; @@ -20,9 +18,10 @@ import org.hibernate.query.hql.spi.SemanticPathPart; import org.hibernate.query.sqm.ParsingException; import org.hibernate.query.sqm.SqmExpressable; import org.hibernate.query.sqm.SqmPathSource; -import org.hibernate.query.sqm.produce.spi.SqmCreationState; +import org.hibernate.query.sqm.spi.SqmCreationState; import org.hibernate.query.sqm.tree.expression.SqmExpression; import org.hibernate.query.sqm.tree.from.SqmRoot; +import org.hibernate.sql.results.spi.DomainResultProducer; import org.hibernate.type.descriptor.java.JavaTypeDescriptor; /** @@ -32,7 +31,7 @@ import org.hibernate.type.descriptor.java.JavaTypeDescriptor; * * @author Steve Ebersole */ -public interface SqmPath extends SqmExpression, SemanticPathPart, JpaPath { +public interface SqmPath extends SqmExpression, SemanticPathPart, JpaPath, DomainResultProducer { /** * Returns the NavigablePath. @@ -47,6 +46,11 @@ public interface SqmPath extends SqmExpression, SemanticPathPart, JpaPath< */ SqmPathSource getReferencedPathSource(); + @Override + default DomainResultProducer getDomainResultProducer() { + return this; + } + /** * Retrieve the explicit alias, if one. May return null */ diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/SqmPluralValuedSimplePath.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/SqmPluralValuedSimplePath.java index 9005c26936..801cffc509 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/SqmPluralValuedSimplePath.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/SqmPluralValuedSimplePath.java @@ -14,9 +14,9 @@ import org.hibernate.persister.collection.CollectionPropertyNames; import org.hibernate.query.NavigablePath; import org.hibernate.query.PathException; import org.hibernate.query.sqm.NodeBuilder; -import org.hibernate.query.sqm.consume.spi.SemanticQueryWalker; +import org.hibernate.query.sqm.spi.SemanticQueryWalker; import org.hibernate.query.hql.spi.SemanticPathPart; -import org.hibernate.query.sqm.produce.spi.SqmCreationState; +import org.hibernate.query.sqm.spi.SqmCreationState; /** * An SqmPath for plural attribute paths diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/SqmPolymorphicRootDescriptor.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/SqmPolymorphicRootDescriptor.java index dbd2f0ee19..0a90d10acd 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/SqmPolymorphicRootDescriptor.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/SqmPolymorphicRootDescriptor.java @@ -34,7 +34,7 @@ import org.hibernate.metamodel.model.domain.PluralPersistentAttribute; import org.hibernate.metamodel.model.domain.SimpleDomainType; import org.hibernate.metamodel.model.domain.SingularPersistentAttribute; import org.hibernate.query.sqm.SqmPathSource; -import org.hibernate.query.sqm.produce.spi.SqmCreationState; +import org.hibernate.query.sqm.spi.SqmCreationState; import org.hibernate.type.descriptor.java.JavaTypeDescriptor; /** diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/SqmSetJoin.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/SqmSetJoin.java index 060d7a51b9..8fa2502dd7 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/SqmSetJoin.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/SqmSetJoin.java @@ -16,13 +16,13 @@ import javax.persistence.metamodel.SingularAttribute; import org.hibernate.NotYetImplementedFor6Exception; import org.hibernate.metamodel.model.domain.EntityDomainType; import org.hibernate.metamodel.model.domain.SetPersistentAttribute; +import org.hibernate.query.PathException; import org.hibernate.query.criteria.JpaExpression; import org.hibernate.query.criteria.JpaPredicate; import org.hibernate.query.criteria.JpaSetJoin; import org.hibernate.query.criteria.JpaSubQuery; -import org.hibernate.query.PathException; import org.hibernate.query.sqm.NodeBuilder; -import org.hibernate.query.sqm.produce.spi.SqmCreationProcessingState; +import org.hibernate.query.sqm.spi.SqmCreationProcessingState; import org.hibernate.query.sqm.tree.SqmJoinType; import org.hibernate.query.sqm.tree.from.SqmAttributeJoin; import org.hibernate.query.sqm.tree.from.SqmFrom; diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/SqmSingularJoin.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/SqmSingularJoin.java index db38795021..ef212be8fb 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/SqmSingularJoin.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/SqmSingularJoin.java @@ -7,16 +7,26 @@ package org.hibernate.query.sqm.tree.domain; import java.util.Locale; +import java.util.function.Consumer; +import org.hibernate.HibernateException; +import org.hibernate.NotYetImplementedFor6Exception; +import org.hibernate.metamodel.model.domain.EmbeddableDomainType; import org.hibernate.metamodel.model.domain.EntityDomainType; +import org.hibernate.metamodel.model.domain.ManagedDomainType; import org.hibernate.metamodel.model.domain.SingularPersistentAttribute; +import org.hibernate.persister.SqlExpressableType; +import org.hibernate.persister.entity.EntityPersister; import org.hibernate.query.PathException; import org.hibernate.query.sqm.NodeBuilder; -import org.hibernate.query.sqm.produce.spi.SqmCreationProcessingState; +import org.hibernate.query.sqm.spi.SqmCreationProcessingState; import org.hibernate.query.sqm.tree.SqmJoinType; import org.hibernate.query.sqm.tree.from.SqmAttributeJoin; import org.hibernate.query.sqm.tree.from.SqmFrom; +import org.hibernate.sql.ast.Clause; +import org.hibernate.sql.results.spi.DomainResultProducer; import org.hibernate.type.descriptor.java.JavaTypeDescriptor; +import org.hibernate.type.spi.TypeConfiguration; /** * @author Steve Ebersole @@ -75,4 +85,33 @@ public class SqmSingularJoin extends AbstractSqmAttributeJoin { nodeBuilder() ); } + + @Override + public void visitJdbcTypes(Consumer action, TypeConfiguration typeConfiguration) { + // todo (6.0) : better as some form of PersistentAttribute -> org.hibernate.persister.walking.spi.AttributeDefinition resolution + + final SingularPersistentAttribute attribute = getReferencedPathSource(); + final ManagedDomainType attributeType = (ManagedDomainType) attribute.getType(); + + if ( attributeType instanceof EntityDomainType ) { + final EntityDomainType entityDomainType = (EntityDomainType) attributeType; + final String entityName = entityDomainType.getHibernateEntityName(); + final EntityPersister entityDescriptor = typeConfiguration.getSessionFactory() + .getMetamodel() + .getEntityDescriptor( entityName ); + entityDescriptor.visitValueMappings( + valueMapping -> valueMapping.getWriteable().visitJdbcTypes( + action, + Clause.IRRELEVANT, + typeConfiguration + ) + ); + } + else if ( attributeType instanceof EmbeddableDomainType ) { + throw new NotYetImplementedFor6Exception( getClass() ); + } + else { + throw new HibernateException( "Unexpected declaring " ); + } + } } diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/SqmTreatedBagJoin.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/SqmTreatedBagJoin.java index ff0ee6a1ec..d8172f32e9 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/SqmTreatedBagJoin.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/SqmTreatedBagJoin.java @@ -8,7 +8,7 @@ package org.hibernate.query.sqm.tree.domain; import org.hibernate.metamodel.model.domain.BagPersistentAttribute; import org.hibernate.metamodel.model.domain.EntityDomainType; -import org.hibernate.query.sqm.produce.spi.SqmCreationProcessingState; +import org.hibernate.query.sqm.spi.SqmCreationProcessingState; import org.hibernate.query.sqm.tree.from.SqmAttributeJoin; /** diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/SqmTreatedListJoin.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/SqmTreatedListJoin.java index 46534c2233..0ebf200f65 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/SqmTreatedListJoin.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/SqmTreatedListJoin.java @@ -8,8 +8,8 @@ package org.hibernate.query.sqm.tree.domain; import org.hibernate.metamodel.model.domain.EntityDomainType; import org.hibernate.metamodel.model.domain.ListPersistentAttribute; -import org.hibernate.query.sqm.produce.spi.SqmCreationProcessingState; -import org.hibernate.query.sqm.produce.spi.SqmCreationState; +import org.hibernate.query.sqm.spi.SqmCreationProcessingState; +import org.hibernate.query.sqm.spi.SqmCreationState; import org.hibernate.query.sqm.tree.expression.SqmExpression; import org.hibernate.query.sqm.tree.from.SqmAttributeJoin; diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/SqmTreatedMapJoin.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/SqmTreatedMapJoin.java index d79c546909..1699d797e1 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/SqmTreatedMapJoin.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/SqmTreatedMapJoin.java @@ -7,7 +7,7 @@ package org.hibernate.query.sqm.tree.domain; import org.hibernate.metamodel.model.domain.EntityDomainType; -import org.hibernate.query.sqm.produce.spi.SqmCreationProcessingState; +import org.hibernate.query.sqm.spi.SqmCreationProcessingState; import org.hibernate.query.sqm.tree.from.SqmAttributeJoin; import org.hibernate.type.descriptor.java.JavaTypeDescriptor; diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/SqmTreatedSetJoin.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/SqmTreatedSetJoin.java index 9524e374f0..5d6ee015fd 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/SqmTreatedSetJoin.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/SqmTreatedSetJoin.java @@ -8,7 +8,7 @@ package org.hibernate.query.sqm.tree.domain; import org.hibernate.metamodel.model.domain.EntityDomainType; import org.hibernate.metamodel.model.domain.SetPersistentAttribute; -import org.hibernate.query.sqm.produce.spi.SqmCreationProcessingState; +import org.hibernate.query.sqm.spi.SqmCreationProcessingState; import org.hibernate.query.sqm.tree.from.SqmAttributeJoin; import org.hibernate.type.descriptor.java.JavaTypeDescriptor; diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/SqmTreatedSimplePath.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/SqmTreatedSimplePath.java index cae717db1e..39e5e6b18e 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/SqmTreatedSimplePath.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/SqmTreatedSimplePath.java @@ -9,7 +9,7 @@ package org.hibernate.query.sqm.tree.domain; import org.hibernate.metamodel.model.domain.EntityDomainType; import org.hibernate.query.PathException; import org.hibernate.query.sqm.NodeBuilder; -import org.hibernate.query.sqm.consume.spi.SemanticQueryWalker; +import org.hibernate.query.sqm.spi.SemanticQueryWalker; /** * @author Steve Ebersole diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/SqmTreatedSingularJoin.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/SqmTreatedSingularJoin.java index 58b71cb17d..7fd1f4b81e 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/SqmTreatedSingularJoin.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/SqmTreatedSingularJoin.java @@ -8,7 +8,7 @@ package org.hibernate.query.sqm.tree.domain; import org.hibernate.metamodel.model.domain.EntityDomainType; import org.hibernate.metamodel.model.domain.SingularPersistentAttribute; -import org.hibernate.query.sqm.produce.spi.SqmCreationProcessingState; +import org.hibernate.query.sqm.spi.SqmCreationProcessingState; import org.hibernate.query.sqm.tree.from.SqmAttributeJoin; import org.hibernate.type.descriptor.java.JavaTypeDescriptor; diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/expression/AbstractSqmExpression.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/expression/AbstractSqmExpression.java index c0cb4c0eb2..bf11770fe6 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/expression/AbstractSqmExpression.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/expression/AbstractSqmExpression.java @@ -14,7 +14,7 @@ import javax.persistence.criteria.Expression; import org.hibernate.query.criteria.JpaSelection; import org.hibernate.query.sqm.NodeBuilder; import org.hibernate.query.sqm.SqmExpressable; -import org.hibernate.query.sqm.produce.SqmTreeCreationLogger; +import org.hibernate.query.sqm.spi.SqmTreeCreationLogger; import org.hibernate.query.sqm.tree.jpa.AbstractJpaSelection; import org.hibernate.query.sqm.tree.predicate.SqmPredicate; import org.hibernate.type.StandardBasicTypes; diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/expression/LiteralHelper.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/expression/LiteralHelper.java index 4b7d45b25c..070290f342 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/expression/LiteralHelper.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/expression/LiteralHelper.java @@ -14,7 +14,7 @@ import java.time.LocalDateTime; import java.time.LocalTime; import org.hibernate.query.spi.QueryEngine; -import org.hibernate.query.sqm.produce.spi.SqmCreationState; +import org.hibernate.query.sqm.spi.SqmCreationState; import org.hibernate.type.StandardBasicTypes; import org.hibernate.type.descriptor.java.JdbcDateTypeDescriptor; import org.hibernate.type.descriptor.java.JdbcTimeTypeDescriptor; diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/expression/SqmBinaryArithmetic.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/expression/SqmBinaryArithmetic.java index d9e3f3972e..ae7a4f6624 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/expression/SqmBinaryArithmetic.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/expression/SqmBinaryArithmetic.java @@ -10,12 +10,13 @@ import org.hibernate.metamodel.model.domain.JpaMetamodel; import org.hibernate.query.BinaryArithmeticOperator; import org.hibernate.query.sqm.NodeBuilder; import org.hibernate.query.sqm.SqmExpressable; -import org.hibernate.query.sqm.consume.spi.SemanticQueryWalker; +import org.hibernate.query.sqm.spi.SemanticQueryWalker; +import org.hibernate.sql.results.spi.DomainResultProducer; /** * @author Steve Ebersole */ -public class SqmBinaryArithmetic extends AbstractSqmExpression { +public class SqmBinaryArithmetic extends AbstractSqmExpression implements DomainResultProducer { private final SqmExpression lhsOperand; private final BinaryArithmeticOperator operator; private final SqmExpression rhsOperand; @@ -105,4 +106,8 @@ public class SqmBinaryArithmetic extends AbstractSqmExpression { return getOperator().toLoggableText( lhsOperand.asLoggableText(), rhsOperand.asLoggableText() ); } + @Override + public DomainResultProducer getDomainResultProducer() { + return this; + } } diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/expression/SqmCaseSearched.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/expression/SqmCaseSearched.java index 1d0948d394..5d887af9d0 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/expression/SqmCaseSearched.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/expression/SqmCaseSearched.java @@ -8,20 +8,22 @@ package org.hibernate.query.sqm.tree.expression; import java.util.ArrayList; import java.util.List; - import javax.persistence.criteria.Expression; import org.hibernate.query.criteria.JpaExpression; import org.hibernate.query.criteria.JpaSearchedCase; import org.hibernate.query.sqm.NodeBuilder; import org.hibernate.query.sqm.SqmExpressable; -import org.hibernate.query.sqm.consume.spi.SemanticQueryWalker; +import org.hibernate.query.sqm.spi.SemanticQueryWalker; import org.hibernate.query.sqm.tree.predicate.SqmPredicate; +import org.hibernate.sql.results.spi.DomainResultProducer; /** * @author Steve Ebersole */ -public class SqmCaseSearched extends AbstractSqmExpression implements JpaSearchedCase { +public class SqmCaseSearched + extends AbstractSqmExpression + implements JpaSearchedCase, DomainResultProducer { private List> whenFragments = new ArrayList<>(); private SqmExpression otherwise; @@ -123,4 +125,9 @@ public class SqmCaseSearched extends AbstractSqmExpression implements JpaS otherwise( (SqmExpression) result ); return this; } + + @Override + public DomainResultProducer getDomainResultProducer() { + return this; + } } diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/expression/SqmCaseSimple.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/expression/SqmCaseSimple.java index 77f69930cc..bd89c32657 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/expression/SqmCaseSimple.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/expression/SqmCaseSimple.java @@ -15,12 +15,15 @@ import org.hibernate.query.criteria.JpaExpression; import org.hibernate.query.criteria.JpaSimpleCase; import org.hibernate.query.sqm.NodeBuilder; import org.hibernate.query.sqm.SqmExpressable; -import org.hibernate.query.sqm.consume.spi.SemanticQueryWalker; +import org.hibernate.query.sqm.spi.SemanticQueryWalker; +import org.hibernate.sql.results.spi.DomainResultProducer; /** * @author Steve Ebersole */ -public class SqmCaseSimple extends AbstractSqmExpression implements JpaSimpleCase { +public class SqmCaseSimple + extends AbstractSqmExpression + implements JpaSimpleCase, DomainResultProducer { private final SqmExpression fixture; private List> whenFragments = new ArrayList<>(); private SqmExpression otherwise; @@ -135,4 +138,9 @@ public class SqmCaseSimple extends AbstractSqmExpression implements JpaS otherwise( (SqmExpression) result ); return this; } + + @Override + public DomainResultProducer getDomainResultProducer() { + return this; + } } diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/expression/SqmCollectionSize.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/expression/SqmCollectionSize.java index 4acaea287e..956a94116b 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/expression/SqmCollectionSize.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/expression/SqmCollectionSize.java @@ -6,13 +6,10 @@ */ package org.hibernate.query.sqm.tree.expression; -import org.hibernate.NotYetImplementedFor6Exception; import org.hibernate.query.sqm.NodeBuilder; import org.hibernate.query.sqm.SqmExpressable; -import org.hibernate.query.sqm.consume.spi.SemanticQueryWalker; +import org.hibernate.query.sqm.spi.SemanticQueryWalker; import org.hibernate.query.sqm.tree.domain.SqmPath; -import org.hibernate.sql.results.spi.DomainResult; -import org.hibernate.sql.results.spi.DomainResultCreationState; import org.hibernate.sql.results.spi.DomainResultProducer; import org.hibernate.type.StandardBasicTypes; @@ -22,11 +19,10 @@ import org.hibernate.type.StandardBasicTypes; * @author Steve Ebersole * @author Gunnar Morling */ -public class SqmCollectionSize extends AbstractSqmExpression implements DomainResultProducer { +public class SqmCollectionSize extends AbstractSqmExpression implements DomainResultProducer { private final SqmPath pluralPath; public SqmCollectionSize(SqmPath pluralPath, NodeBuilder nodeBuilder) { - //noinspection unchecked this( pluralPath, StandardBasicTypes.INTEGER, nodeBuilder ); } @@ -49,6 +45,11 @@ public class SqmCollectionSize extends AbstractSqmExpression implements return "SIZE(" + pluralPath.asLoggableText() + ")"; } + @Override + public DomainResultProducer getDomainResultProducer() { + return this; + } + // @Override // public DomainResult createDomainResult( // String resultVariable, diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/expression/SqmCriteriaParameter.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/expression/SqmCriteriaParameter.java index c4e37cea61..81f5a88ac7 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/expression/SqmCriteriaParameter.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/expression/SqmCriteriaParameter.java @@ -13,7 +13,8 @@ import org.hibernate.query.ParameterMetadata; import org.hibernate.query.spi.QueryParameterImplementor; import org.hibernate.query.sqm.NodeBuilder; import org.hibernate.query.sqm.SqmExpressable; -import org.hibernate.query.sqm.consume.spi.SemanticQueryWalker; +import org.hibernate.query.sqm.spi.SemanticQueryWalker; +import org.hibernate.sql.results.spi.DomainResultProducer; /** * SqmParameter created via JPA {@link javax.persistence.criteria.CriteriaBuilder} @@ -25,7 +26,7 @@ import org.hibernate.query.sqm.consume.spi.SemanticQueryWalker; */ public class SqmCriteriaParameter extends AbstractSqmExpression - implements SqmParameter, QueryParameterImplementor { + implements SqmParameter, QueryParameterImplementor, DomainResultProducer { private final String name; private boolean allowMultiValuedBinding; @@ -120,4 +121,9 @@ public class SqmCriteriaParameter public NamedCallableQueryMemento.ParameterMemento toMemento() { throw new UnsupportedOperationException( "ParameterMemento cannot be extracted from Criteria query parameter" ); } + + @Override + public DomainResultProducer getDomainResultProducer() { + return this; + } } diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/expression/SqmEntityType.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/expression/SqmEntityType.java index c852a03c29..3dcfb7093f 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/expression/SqmEntityType.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/expression/SqmEntityType.java @@ -9,10 +9,8 @@ package org.hibernate.query.sqm.tree.expression; import org.hibernate.metamodel.model.domain.EntityDomainType; import org.hibernate.query.sqm.NodeBuilder; import org.hibernate.query.sqm.SqmExpressable; -import org.hibernate.query.sqm.consume.spi.SemanticQueryWalker; +import org.hibernate.query.sqm.spi.SemanticQueryWalker; import org.hibernate.query.sqm.tree.domain.SqmPath; -import org.hibernate.sql.results.spi.DomainResult; -import org.hibernate.sql.results.spi.DomainResultCreationState; import org.hibernate.sql.results.spi.DomainResultProducer; /** @@ -20,7 +18,7 @@ import org.hibernate.sql.results.spi.DomainResultProducer; * * @author Steve Ebersole */ -public class SqmEntityType extends AbstractSqmExpression implements DomainResultProducer { +public class SqmEntityType extends AbstractSqmExpression implements DomainResultProducer { private final SqmExpression discriminatorSource; public SqmEntityType(SqmParameter parameterExpression, NodeBuilder nodeBuilder) { @@ -47,12 +45,10 @@ public class SqmEntityType extends AbstractSqmExpression implements Domain return walker.visitParameterizedEntityTypeExpression( this ); } -// @Override -// public DomainResult createDomainResult( -// String resultVariable, -// DomainResultCreationState creationState) { -// throw new UnsupportedOperationException( "At the moment, selection of an entity's type as a QueryResult is not supported" ); -// // todo (6.0) : but could be ^^ - consider adding support for this (returning Class) -// } + @Override + public DomainResultProducer getDomainResultProducer() { + // technically `T` should be `Class` here + return this; + } } diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/expression/SqmEnumLiteral.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/expression/SqmEnumLiteral.java index 7deadc76e1..c9eea1f862 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/expression/SqmEnumLiteral.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/expression/SqmEnumLiteral.java @@ -18,10 +18,11 @@ import org.hibernate.query.criteria.JpaSelection; import org.hibernate.query.hql.spi.SemanticPathPart; import org.hibernate.query.sqm.NodeBuilder; import org.hibernate.query.sqm.SqmExpressable; -import org.hibernate.query.sqm.consume.spi.SemanticQueryWalker; -import org.hibernate.query.sqm.produce.spi.SqmCreationState; +import org.hibernate.query.sqm.spi.SemanticQueryWalker; +import org.hibernate.query.sqm.spi.SqmCreationState; import org.hibernate.query.sqm.tree.domain.SqmPath; import org.hibernate.query.sqm.tree.predicate.SqmPredicate; +import org.hibernate.sql.results.spi.DomainResultProducer; import org.hibernate.type.descriptor.java.EnumJavaTypeDescriptor; import org.hibernate.type.descriptor.java.JavaTypeDescriptor; @@ -31,7 +32,7 @@ import org.hibernate.type.descriptor.java.JavaTypeDescriptor; * * @author Steve Ebersole */ -public class SqmEnumLiteral implements SqmExpression, SqmExpressable, SemanticPathPart { +public class SqmEnumLiteral implements SqmExpression, SqmExpressable, DomainResultProducer, SemanticPathPart { private final Enum enumValue; private final EnumJavaTypeDescriptor referencedEnumTypeDescriptor; private final String enumValueName; @@ -215,4 +216,9 @@ public class SqmEnumLiteral implements SqmExpression, SqmExpressable public String getAlias() { return null; } + + @Override + public DomainResultProducer getDomainResultProducer() { + return this; + } } diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/expression/SqmFieldLiteral.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/expression/SqmFieldLiteral.java index f0ff7500ed..77ab92fd45 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/expression/SqmFieldLiteral.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/expression/SqmFieldLiteral.java @@ -20,16 +20,17 @@ import org.hibernate.query.criteria.JpaSelection; import org.hibernate.query.hql.spi.SemanticPathPart; import org.hibernate.query.sqm.NodeBuilder; import org.hibernate.query.sqm.SqmExpressable; -import org.hibernate.query.sqm.consume.spi.SemanticQueryWalker; -import org.hibernate.query.sqm.produce.spi.SqmCreationState; +import org.hibernate.query.sqm.spi.SemanticQueryWalker; +import org.hibernate.query.sqm.spi.SqmCreationState; import org.hibernate.query.sqm.tree.domain.SqmPath; import org.hibernate.query.sqm.tree.predicate.SqmPredicate; +import org.hibernate.sql.results.spi.DomainResultProducer; import org.hibernate.type.descriptor.java.JavaTypeDescriptor; /** * @author Steve Ebersole */ -public class SqmFieldLiteral implements SqmExpression, SqmExpressable, SemanticPathPart { +public class SqmFieldLiteral implements SqmExpression, SqmExpressable, DomainResultProducer, SemanticPathPart { private final T value; private final JavaTypeDescriptor fieldJavaTypeDescriptor; private final String fieldName; @@ -250,4 +251,9 @@ public class SqmFieldLiteral implements SqmExpression, SqmExpressable, public String getAlias() { return null; } + + @Override + public DomainResultProducer getDomainResultProducer() { + return this; + } } diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/expression/SqmLiteral.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/expression/SqmLiteral.java index 68e4e68ac3..53958a2794 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/expression/SqmLiteral.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/expression/SqmLiteral.java @@ -8,7 +8,8 @@ package org.hibernate.query.sqm.tree.expression; import org.hibernate.query.sqm.NodeBuilder; import org.hibernate.query.sqm.SqmExpressable; -import org.hibernate.query.sqm.consume.spi.SemanticQueryWalker; +import org.hibernate.query.sqm.spi.SemanticQueryWalker; +import org.hibernate.sql.results.spi.DomainResultProducer; /** * Represents a literal value in the sqm, e.g.
    @@ -20,7 +21,9 @@ import org.hibernate.query.sqm.consume.spi.SemanticQueryWalker; *
* @author Steve Ebersole */ -public class SqmLiteral extends AbstractSqmExpression implements SqmExpression { +public class SqmLiteral + extends AbstractSqmExpression + implements SqmExpression, DomainResultProducer { private T value; public SqmLiteral(T value, SqmExpressable inherentType, NodeBuilder nodeBuilder) { @@ -41,4 +44,9 @@ public class SqmLiteral extends AbstractSqmExpression implements SqmExpres public String asLoggableText() { return "Literal( " + value + ")"; } + + @Override + public DomainResultProducer getDomainResultProducer() { + return this; + } } diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/expression/SqmLiteralEntityType.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/expression/SqmLiteralEntityType.java index 3bcb238b2a..7efaf4febe 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/expression/SqmLiteralEntityType.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/expression/SqmLiteralEntityType.java @@ -9,14 +9,11 @@ package org.hibernate.query.sqm.tree.expression; import org.hibernate.metamodel.model.domain.EntityDomainType; import org.hibernate.query.hql.spi.SemanticPathPart; import org.hibernate.query.sqm.NodeBuilder; -import org.hibernate.query.SemanticException; import org.hibernate.query.sqm.SqmExpressable; -import org.hibernate.query.sqm.consume.spi.SemanticQueryWalker; +import org.hibernate.query.sqm.spi.SemanticQueryWalker; import org.hibernate.query.hql.HqlInterpretationException; -import org.hibernate.query.sqm.produce.spi.SqmCreationState; +import org.hibernate.query.sqm.spi.SqmCreationState; import org.hibernate.query.sqm.tree.domain.SqmPath; -import org.hibernate.sql.results.spi.DomainResult; -import org.hibernate.sql.results.spi.DomainResultCreationState; import org.hibernate.sql.results.spi.DomainResultProducer; import org.hibernate.type.descriptor.java.JavaTypeDescriptor; @@ -31,7 +28,7 @@ import org.hibernate.type.descriptor.java.JavaTypeDescriptor; */ public class SqmLiteralEntityType extends AbstractSqmExpression - implements DomainResultProducer, SemanticPathPart { + implements DomainResultProducer, SemanticPathPart { private final EntityDomainType entityType; public SqmLiteralEntityType(EntityDomainType entityType, NodeBuilder nodeBuilder) { @@ -87,4 +84,10 @@ public class SqmLiteralEntityType SqmCreationState creationState) { throw new HqlInterpretationException( "Cannot dereference an entity name" ); } + + @Override + public DomainResultProducer getDomainResultProducer() { + // technically `T` should be `Class` here + return this; + } } diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/expression/SqmLiteralNull.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/expression/SqmLiteralNull.java index d05c0f8ea1..6a9dd0bfda 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/expression/SqmLiteralNull.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/expression/SqmLiteralNull.java @@ -8,7 +8,7 @@ package org.hibernate.query.sqm.tree.expression; import org.hibernate.query.sqm.NodeBuilder; import org.hibernate.query.sqm.SqmExpressable; -import org.hibernate.query.sqm.consume.spi.SemanticQueryWalker; +import org.hibernate.query.sqm.spi.SemanticQueryWalker; /** * @author Steve Ebersole diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/expression/SqmNamedParameter.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/expression/SqmNamedParameter.java index abb9007cbf..759a9a16ad 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/expression/SqmNamedParameter.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/expression/SqmNamedParameter.java @@ -8,7 +8,8 @@ package org.hibernate.query.sqm.tree.expression; import org.hibernate.metamodel.model.domain.AllowableParameterType; import org.hibernate.query.sqm.NodeBuilder; -import org.hibernate.query.sqm.consume.spi.SemanticQueryWalker; +import org.hibernate.query.sqm.spi.SemanticQueryWalker; +import org.hibernate.sql.results.spi.DomainResultProducer; /** * Represents a named query parameter in the SQM tree. @@ -36,6 +37,11 @@ public class SqmNamedParameter extends AbstractSqmParameter { return walker.visitNamedParameterExpression( this ); } + @Override + public DomainResultProducer getDomainResultProducer() { + throw new UnsupportedOperationException( ); + } + @Override public String asLoggableText() { return ":" + getName(); diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/expression/SqmPositionalParameter.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/expression/SqmPositionalParameter.java index 5f5fc0680e..3004335be1 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/expression/SqmPositionalParameter.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/expression/SqmPositionalParameter.java @@ -8,7 +8,8 @@ package org.hibernate.query.sqm.tree.expression; import org.hibernate.metamodel.model.domain.AllowableParameterType; import org.hibernate.query.sqm.NodeBuilder; -import org.hibernate.query.sqm.consume.spi.SemanticQueryWalker; +import org.hibernate.query.sqm.spi.SemanticQueryWalker; +import org.hibernate.sql.results.spi.DomainResultProducer; /** * Models a positional parameter expression @@ -54,4 +55,8 @@ public class SqmPositionalParameter extends AbstractSqmParameter { return "?" + getPosition(); } + @Override + public DomainResultProducer getDomainResultProducer() { + throw new UnsupportedOperationException( ); + } } diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/expression/SqmRestrictedSubQueryExpression.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/expression/SqmRestrictedSubQueryExpression.java index d84e265feb..d54baf899d 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/expression/SqmRestrictedSubQueryExpression.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/expression/SqmRestrictedSubQueryExpression.java @@ -9,7 +9,8 @@ package org.hibernate.query.sqm.tree.expression; import org.hibernate.query.sqm.NodeBuilder; import org.hibernate.query.sqm.SqmExpressable; import org.hibernate.query.sqm.tree.select.SqmSubQuery; -import org.hibernate.query.sqm.consume.spi.SemanticQueryWalker; +import org.hibernate.query.sqm.spi.SemanticQueryWalker; +import org.hibernate.sql.results.spi.DomainResultProducer; /** * Represents a {@link Modifier#ALL}, {@link Modifier#ANY}, {@link Modifier#SOME} modifier appplied to a subquery as @@ -61,4 +62,9 @@ public class SqmRestrictedSubQueryExpression extends AbstractSqmExpression public X accept(SemanticQueryWalker walker) { return walker.visitRestrictedSubQueryExpression( this ); } + + @Override + public DomainResultProducer getDomainResultProducer() { + return subQuery.getDomainResultProducer(); + } } diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/expression/SqmTuple.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/expression/SqmTuple.java index c08d481db0..006cece980 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/expression/SqmTuple.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/expression/SqmTuple.java @@ -14,8 +14,9 @@ import org.hibernate.query.criteria.JpaCompoundSelection; import org.hibernate.query.criteria.JpaSelection; import org.hibernate.query.sqm.NodeBuilder; import org.hibernate.query.sqm.SqmExpressable; -import org.hibernate.query.sqm.consume.spi.SemanticQueryWalker; +import org.hibernate.query.sqm.spi.SemanticQueryWalker; import org.hibernate.query.sqm.tree.select.SqmJpaCompoundSelection; +import org.hibernate.sql.results.spi.DomainResultProducer; import org.hibernate.type.descriptor.java.JavaTypeDescriptor; /** @@ -96,26 +97,9 @@ public class SqmTuple extends AbstractSqmExpression implements JpaCompound return groupedExpressions; } - // @Override -// public QueryResult createDomainResult( -// SemanticQueryWalker walker, -// String resultVariable, -// QueryResultCreationContext creationContext) { -// return null; -// } -// -// @Override -// public QueryResult createDomainResult( -// Expression expression, -// String resultVariable, -// QueryResultCreationContext creationContext) { -// // todo (6.0) : pretty sure this is not correct. -// // should return a result over all the expressions, not just the first - -// // a "composite" result. -// // -// // todo (6.0) : ultimately the problem here is expecting the "resolved" SQL AST node to be passed in. -// // really resolving these SQL AST nodes should be done here. -// return groupedExpressions.get( 0 ).createDomainResult( expression, resultVariable, creationContext ); -// } - + @Override + public DomainResultProducer getDomainResultProducer() { + // could technically return an array I guess + throw new UnsupportedOperationException(); + } } diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/expression/SqmUnaryOperation.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/expression/SqmUnaryOperation.java index 2011bb2370..2b54bfbc60 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/expression/SqmUnaryOperation.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/expression/SqmUnaryOperation.java @@ -8,12 +8,13 @@ package org.hibernate.query.sqm.tree.expression; import org.hibernate.query.UnaryArithmeticOperator; import org.hibernate.query.sqm.SqmExpressable; -import org.hibernate.query.sqm.consume.spi.SemanticQueryWalker; +import org.hibernate.query.sqm.spi.SemanticQueryWalker; +import org.hibernate.sql.results.spi.DomainResultProducer; /** * @author Steve Ebersole */ -public class SqmUnaryOperation extends AbstractSqmExpression { +public class SqmUnaryOperation extends AbstractSqmExpression implements DomainResultProducer { private final UnaryArithmeticOperator operation; private final SqmExpression operand; @@ -40,6 +41,11 @@ public class SqmUnaryOperation extends AbstractSqmExpression { return operation; } + @Override + public DomainResultProducer getDomainResultProducer() { + return this; + } + @Override public X accept(SemanticQueryWalker walker) { return walker.visitUnaryOperationExpression( this ); diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/from/SqmAttributeJoin.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/from/SqmAttributeJoin.java index 1e5c70896f..8219e2a109 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/from/SqmAttributeJoin.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/from/SqmAttributeJoin.java @@ -10,7 +10,7 @@ import org.hibernate.HibernateException; import org.hibernate.query.criteria.JpaFetch; import org.hibernate.query.criteria.JpaJoin; import org.hibernate.query.sqm.SqmPathSource; -import org.hibernate.query.sqm.produce.spi.SqmCreationProcessingState; +import org.hibernate.query.sqm.spi.SqmCreationProcessingState; import org.hibernate.query.sqm.tree.predicate.SqmPredicate; import org.hibernate.type.descriptor.java.JavaTypeDescriptor; diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/from/SqmCrossJoin.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/from/SqmCrossJoin.java index 1bb7dbad7c..754a897ff8 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/from/SqmCrossJoin.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/from/SqmCrossJoin.java @@ -8,14 +8,14 @@ package org.hibernate.query.sqm.tree.from; import org.hibernate.metamodel.model.domain.EntityDomainType; import org.hibernate.query.PathException; -import org.hibernate.query.sqm.consume.spi.SemanticQueryWalker; +import org.hibernate.query.sqm.spi.SemanticQueryWalker; import org.hibernate.query.sqm.tree.SqmJoinType; import org.hibernate.query.sqm.tree.domain.AbstractSqmFrom; import org.hibernate.query.sqm.tree.domain.SqmPath; import org.hibernate.query.sqm.tree.domain.SqmTreatedCrossJoin; import org.hibernate.type.descriptor.java.JavaTypeDescriptor; -import static org.hibernate.query.sqm.produce.SqmCreationHelper.buildRootNavigablePath; +import static org.hibernate.query.sqm.spi.SqmCreationHelper.buildRootNavigablePath; /** * @author Steve Ebersole diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/from/SqmEntityJoin.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/from/SqmEntityJoin.java index d026c06797..7896b6713c 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/from/SqmEntityJoin.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/from/SqmEntityJoin.java @@ -8,13 +8,14 @@ package org.hibernate.query.sqm.tree.from; import org.hibernate.metamodel.model.domain.EntityDomainType; import org.hibernate.query.PathException; -import org.hibernate.query.sqm.consume.spi.SemanticQueryWalker; -import org.hibernate.query.sqm.produce.SqmCreationHelper; +import org.hibernate.query.sqm.spi.SemanticQueryWalker; +import org.hibernate.query.sqm.spi.SqmCreationHelper; import org.hibernate.query.sqm.tree.SqmJoinType; import org.hibernate.query.sqm.tree.domain.AbstractSqmJoin; import org.hibernate.query.sqm.tree.domain.SqmPath; import org.hibernate.query.sqm.tree.domain.SqmTreatedEntityJoin; import org.hibernate.query.sqm.tree.predicate.SqmPredicate; +import org.hibernate.sql.results.spi.DomainResultProducer; /** * @author Steve Ebersole diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/from/SqmRoot.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/from/SqmRoot.java index 00ce25f750..efc27577c1 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/from/SqmRoot.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/from/SqmRoot.java @@ -6,16 +6,24 @@ */ package org.hibernate.query.sqm.tree.from; +import java.util.function.Consumer; + import org.hibernate.metamodel.model.domain.EntityDomainType; -import org.hibernate.query.criteria.JpaRoot; +import org.hibernate.persister.SqlExpressableType; +import org.hibernate.persister.entity.EntityPersister; import org.hibernate.query.PathException; +import org.hibernate.query.criteria.JpaRoot; import org.hibernate.query.sqm.NodeBuilder; -import org.hibernate.query.sqm.consume.spi.SemanticQueryWalker; +import org.hibernate.query.sqm.spi.SemanticQueryWalker; import org.hibernate.query.sqm.tree.domain.AbstractSqmFrom; import org.hibernate.query.sqm.tree.domain.SqmPath; import org.hibernate.query.sqm.tree.domain.SqmTreatedPath; import org.hibernate.query.sqm.tree.domain.SqmTreatedRoot; +import org.hibernate.sql.ast.Clause; +import org.hibernate.sql.results.spi.DomainResult; +import org.hibernate.sql.results.spi.DomainResultCreationState; import org.hibernate.type.descriptor.java.JavaTypeDescriptor; +import org.hibernate.type.spi.TypeConfiguration; /** * @author Steve Ebersole @@ -88,4 +96,48 @@ public class SqmRoot extends AbstractSqmFrom implements JpaRoot { public SqmTreatedPath treatAs(EntityDomainType treatTarget) throws PathException { return new SqmTreatedRoot<>( this, treatTarget, nodeBuilder() ); } + + @Override + public void visitJdbcTypes(Consumer action, TypeConfiguration typeConfiguration) { + final String entityName = getReferencedPathSource().getHibernateEntityName(); + final EntityPersister entityDescriptor = typeConfiguration.getSessionFactory() + .getMetamodel() + .getEntityDescriptor( entityName ); + entityDescriptor.visitValueMappings( + valueMapping -> valueMapping.getWriteable().visitJdbcTypes( + action, + Clause.IRRELEVANT, + typeConfiguration + ) + ); + } + + @Override + public DomainResult createDomainResult( + int valuesArrayPosition, + String resultVariable, + DomainResultCreationState creationState) { + final String entityName = getReferencedPathSource().getHibernateEntityName(); + final EntityPersister entityDescriptor = creationState.getSqlAstCreationState() + .getCreationContext() + .getDomainModel() + .getEntityDescriptor( entityName ); + return entityDescriptor.createDomainResult( + getNavigablePath(), + valuesArrayPosition, + resultVariable, + creationState + ); + } + + @Override + public void applySqlSelections(DomainResultCreationState creationState) { + final String entityName = getReferencedPathSource().getHibernateEntityName(); + final EntityPersister entityDescriptor = creationState.getSqlAstCreationState() + .getCreationContext() + .getDomainModel() + .getEntityDescriptor( entityName ); + entityDescriptor.applySqlSelections( getNavigablePath(), creationState ); + + } } diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/insert/SqmInsertSelectStatement.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/insert/SqmInsertSelectStatement.java index a8c0d4322d..752a78a4bb 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/insert/SqmInsertSelectStatement.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/insert/SqmInsertSelectStatement.java @@ -10,7 +10,7 @@ import org.hibernate.query.criteria.JpaCriteriaInsertSelect; import org.hibernate.query.criteria.JpaPredicate; import org.hibernate.query.sqm.NodeBuilder; import org.hibernate.query.sqm.SqmQuerySource; -import org.hibernate.query.sqm.consume.spi.SemanticQueryWalker; +import org.hibernate.query.sqm.spi.SemanticQueryWalker; import org.hibernate.query.sqm.tree.select.SqmQuerySpec; import org.hibernate.query.sqm.tree.from.SqmRoot; diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/jpa/ParameterCollector.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/jpa/ParameterCollector.java index f810cf7021..c928000697 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/jpa/ParameterCollector.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/jpa/ParameterCollector.java @@ -10,7 +10,7 @@ import java.util.Collections; import java.util.HashSet; import java.util.Set; -import org.hibernate.query.sqm.consume.spi.BaseSemanticQueryWalker; +import org.hibernate.query.sqm.spi.BaseSemanticQueryWalker; import org.hibernate.query.sqm.tree.SqmStatement; import org.hibernate.query.sqm.tree.expression.SqmCriteriaParameter; import org.hibernate.query.sqm.tree.expression.SqmNamedParameter; diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/predicate/SqmAndPredicate.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/predicate/SqmAndPredicate.java index cb6f6296a3..e83e412622 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/predicate/SqmAndPredicate.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/predicate/SqmAndPredicate.java @@ -11,7 +11,7 @@ import java.util.List; import javax.persistence.criteria.Expression; import org.hibernate.query.sqm.NodeBuilder; -import org.hibernate.query.sqm.consume.spi.SemanticQueryWalker; +import org.hibernate.query.sqm.spi.SemanticQueryWalker; /** * @author Steve Ebersole diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/predicate/SqmBetweenPredicate.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/predicate/SqmBetweenPredicate.java index d4efe4da7c..6d17029ce3 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/predicate/SqmBetweenPredicate.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/predicate/SqmBetweenPredicate.java @@ -9,7 +9,7 @@ package org.hibernate.query.sqm.tree.predicate; import org.hibernate.query.internal.QueryHelper; import org.hibernate.query.sqm.NodeBuilder; import org.hibernate.query.sqm.SqmExpressable; -import org.hibernate.query.sqm.consume.spi.SemanticQueryWalker; +import org.hibernate.query.sqm.spi.SemanticQueryWalker; import org.hibernate.query.sqm.tree.expression.SqmExpression; /** diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/predicate/SqmBooleanExpressionPredicate.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/predicate/SqmBooleanExpressionPredicate.java index cdfa6ec929..15651ea700 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/predicate/SqmBooleanExpressionPredicate.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/predicate/SqmBooleanExpressionPredicate.java @@ -12,9 +12,8 @@ import javax.persistence.criteria.Expression; import org.hibernate.metamodel.model.domain.BasicDomainType; import org.hibernate.query.sqm.NodeBuilder; -import org.hibernate.query.sqm.consume.spi.SemanticQueryWalker; +import org.hibernate.query.sqm.spi.SemanticQueryWalker; import org.hibernate.query.sqm.tree.expression.SqmExpression; -import org.hibernate.type.BasicType; /** * Represents an expression whose type is boolean, and can therefore be used as a predicate. diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/predicate/SqmComparisonPredicate.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/predicate/SqmComparisonPredicate.java index b6e14ef5fe..f874464295 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/predicate/SqmComparisonPredicate.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/predicate/SqmComparisonPredicate.java @@ -10,7 +10,7 @@ import org.hibernate.query.ComparisonOperator; import org.hibernate.query.internal.QueryHelper; import org.hibernate.query.sqm.NodeBuilder; import org.hibernate.query.sqm.SqmExpressable; -import org.hibernate.query.sqm.consume.spi.SemanticQueryWalker; +import org.hibernate.query.sqm.spi.SemanticQueryWalker; import org.hibernate.query.sqm.tree.expression.SqmExpression; /** diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/predicate/SqmEmptinessPredicate.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/predicate/SqmEmptinessPredicate.java index 5efb71cb6e..49615991b8 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/predicate/SqmEmptinessPredicate.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/predicate/SqmEmptinessPredicate.java @@ -7,7 +7,7 @@ package org.hibernate.query.sqm.tree.predicate; import org.hibernate.query.sqm.NodeBuilder; -import org.hibernate.query.sqm.consume.spi.SemanticQueryWalker; +import org.hibernate.query.sqm.spi.SemanticQueryWalker; import org.hibernate.query.sqm.tree.domain.SqmPath; /** diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/predicate/SqmGroupedPredicate.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/predicate/SqmGroupedPredicate.java index e1bc9ea3cb..6081f6ba93 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/predicate/SqmGroupedPredicate.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/predicate/SqmGroupedPredicate.java @@ -11,7 +11,7 @@ import java.util.List; import javax.persistence.criteria.Expression; import org.hibernate.query.sqm.NodeBuilder; -import org.hibernate.query.sqm.consume.spi.SemanticQueryWalker; +import org.hibernate.query.sqm.spi.SemanticQueryWalker; /** * @author Steve Ebersole diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/predicate/SqmInListPredicate.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/predicate/SqmInListPredicate.java index 1f2a7b9441..632a7fc541 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/predicate/SqmInListPredicate.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/predicate/SqmInListPredicate.java @@ -15,7 +15,7 @@ import org.hibernate.internal.util.collections.ArrayHelper; import org.hibernate.query.criteria.JpaExpression; import org.hibernate.query.internal.QueryHelper; import org.hibernate.query.sqm.NodeBuilder; -import org.hibernate.query.sqm.consume.spi.SemanticQueryWalker; +import org.hibernate.query.sqm.spi.SemanticQueryWalker; import org.hibernate.query.sqm.tree.expression.SqmExpression; /** diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/predicate/SqmInSubQueryPredicate.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/predicate/SqmInSubQueryPredicate.java index 12508bd6e4..777903d633 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/predicate/SqmInSubQueryPredicate.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/predicate/SqmInSubQueryPredicate.java @@ -12,7 +12,7 @@ import org.hibernate.query.criteria.JpaExpression; import org.hibernate.query.internal.QueryHelper; import org.hibernate.query.sqm.NodeBuilder; import org.hibernate.query.sqm.SqmExpressable; -import org.hibernate.query.sqm.consume.spi.SemanticQueryWalker; +import org.hibernate.query.sqm.spi.SemanticQueryWalker; import org.hibernate.query.sqm.tree.expression.SqmExpression; import org.hibernate.query.sqm.tree.select.SqmSubQuery; diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/predicate/SqmLikePredicate.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/predicate/SqmLikePredicate.java index 3ea739f5ff..4c175fab26 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/predicate/SqmLikePredicate.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/predicate/SqmLikePredicate.java @@ -7,7 +7,7 @@ package org.hibernate.query.sqm.tree.predicate; import org.hibernate.query.sqm.NodeBuilder; -import org.hibernate.query.sqm.consume.spi.SemanticQueryWalker; +import org.hibernate.query.sqm.spi.SemanticQueryWalker; import org.hibernate.query.sqm.tree.expression.SqmExpression; /** diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/predicate/SqmMemberOfPredicate.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/predicate/SqmMemberOfPredicate.java index 58de2da3e0..4f4742d5bf 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/predicate/SqmMemberOfPredicate.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/predicate/SqmMemberOfPredicate.java @@ -7,7 +7,7 @@ package org.hibernate.query.sqm.tree.predicate; import org.hibernate.query.sqm.NodeBuilder; -import org.hibernate.query.sqm.consume.spi.SemanticQueryWalker; +import org.hibernate.query.sqm.spi.SemanticQueryWalker; import org.hibernate.query.sqm.tree.domain.SqmPath; /** diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/predicate/SqmNegatedPredicate.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/predicate/SqmNegatedPredicate.java index eb9e72ad98..520946ae1a 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/predicate/SqmNegatedPredicate.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/predicate/SqmNegatedPredicate.java @@ -11,7 +11,7 @@ import java.util.List; import javax.persistence.criteria.Expression; import org.hibernate.query.sqm.NodeBuilder; -import org.hibernate.query.sqm.consume.spi.SemanticQueryWalker; +import org.hibernate.query.sqm.spi.SemanticQueryWalker; /** * @author Steve Ebersole diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/predicate/SqmNullnessPredicate.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/predicate/SqmNullnessPredicate.java index ba2b51f3c8..d247563590 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/predicate/SqmNullnessPredicate.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/predicate/SqmNullnessPredicate.java @@ -7,7 +7,7 @@ package org.hibernate.query.sqm.tree.predicate; import org.hibernate.query.sqm.NodeBuilder; -import org.hibernate.query.sqm.consume.spi.SemanticQueryWalker; +import org.hibernate.query.sqm.spi.SemanticQueryWalker; import org.hibernate.query.sqm.tree.expression.SqmExpression; /** diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/predicate/SqmOrPredicate.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/predicate/SqmOrPredicate.java index 8bab653aab..8bfad611bd 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/predicate/SqmOrPredicate.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/predicate/SqmOrPredicate.java @@ -11,7 +11,7 @@ import java.util.List; import javax.persistence.criteria.Expression; import org.hibernate.query.sqm.NodeBuilder; -import org.hibernate.query.sqm.consume.spi.SemanticQueryWalker; +import org.hibernate.query.sqm.spi.SemanticQueryWalker; import org.hibernate.query.sqm.tree.expression.AbstractSqmExpression; /** diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/predicate/SqmPredicate.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/predicate/SqmPredicate.java index caaef58082..ab2a2986c4 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/predicate/SqmPredicate.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/predicate/SqmPredicate.java @@ -9,13 +9,15 @@ package org.hibernate.query.sqm.tree.predicate; import org.hibernate.query.criteria.JpaPredicate; import org.hibernate.query.sqm.tree.SqmVisitableNode; import org.hibernate.query.sqm.tree.expression.SqmExpression; +import org.hibernate.sql.results.spi.DomainResultProducer; import org.hibernate.type.descriptor.java.BooleanTypeDescriptor; import org.hibernate.type.descriptor.java.JavaTypeDescriptor; /** * @author Steve Ebersole */ -public interface SqmPredicate extends SqmVisitableNode, JpaPredicate, SqmExpression { +public interface SqmPredicate + extends SqmVisitableNode, JpaPredicate, SqmExpression, DomainResultProducer { @Override default JavaTypeDescriptor getJavaTypeDescriptor(){ return BooleanTypeDescriptor.INSTANCE; @@ -24,5 +26,8 @@ public interface SqmPredicate extends SqmVisitableNode, JpaPredicate, SqmExpress @Override SqmPredicate not(); - + @Override + default DomainResultProducer getDomainResultProducer() { + return this; + } } diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/select/SqmDynamicInstantiation.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/select/SqmDynamicInstantiation.java index c805d9a905..7af4fdd505 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/select/SqmDynamicInstantiation.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/select/SqmDynamicInstantiation.java @@ -15,9 +15,10 @@ import org.hibernate.query.DynamicInstantiationNature; import org.hibernate.query.criteria.JpaCompoundSelection; import org.hibernate.query.criteria.JpaSelection; import org.hibernate.query.sqm.NodeBuilder; -import org.hibernate.query.sqm.consume.spi.SemanticQueryWalker; +import org.hibernate.query.sqm.spi.SemanticQueryWalker; import org.hibernate.query.sqm.tree.expression.SqmExpression; import org.hibernate.query.sqm.tree.jpa.AbstractJpaSelection; +import org.hibernate.sql.results.spi.DomainResultProducer; import org.hibernate.type.descriptor.java.JavaTypeDescriptor; import org.jboss.logging.Logger; @@ -33,7 +34,10 @@ import static org.hibernate.query.DynamicInstantiationNature.MAP; */ public class SqmDynamicInstantiation extends AbstractJpaSelection - implements SqmSelectableNode, SqmAliasedExpressionContainer, JpaCompoundSelection { + implements SqmSelectableNode, + SqmAliasedExpressionContainer, + JpaCompoundSelection, + DomainResultProducer { private static final Logger log = Logger.getLogger( SqmDynamicInstantiation.class ); @@ -114,6 +118,11 @@ public class SqmDynamicInstantiation return getInstantiationTarget().getTargetTypeDescriptor(); } + @Override + public DomainResultProducer getDomainResultProducer() { + return this; + } + @Override public String asLoggableText() { return ""; diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/select/SqmJpaCompoundSelection.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/select/SqmJpaCompoundSelection.java index 4df3805363..819ecb5c69 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/select/SqmJpaCompoundSelection.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/select/SqmJpaCompoundSelection.java @@ -10,12 +10,14 @@ import java.util.List; import javax.persistence.criteria.Selection; +import org.hibernate.NotYetImplementedFor6Exception; import org.hibernate.query.criteria.JpaCompoundSelection; import org.hibernate.query.criteria.JpaSelection; import org.hibernate.query.sqm.NodeBuilder; import org.hibernate.query.sqm.SqmExpressable; -import org.hibernate.query.sqm.consume.spi.SemanticQueryWalker; +import org.hibernate.query.sqm.spi.SemanticQueryWalker; import org.hibernate.query.sqm.tree.expression.AbstractSqmExpression; +import org.hibernate.sql.results.spi.DomainResultProducer; import org.hibernate.type.descriptor.java.JavaTypeDescriptor; /** @@ -36,7 +38,7 @@ import org.hibernate.type.descriptor.java.JavaTypeDescriptor; */ public class SqmJpaCompoundSelection extends AbstractSqmExpression - implements JpaCompoundSelection, SqmExpressable { + implements JpaCompoundSelection, SqmExpressable, DomainResultProducer { // todo (6.0) : should this really be SqmExpressable? // - seems like it ought to be limited to just `SqmSelectableNode`. @@ -107,4 +109,10 @@ public class SqmJpaCompoundSelection public X accept(SemanticQueryWalker walker) { return walker.visitJpaCompoundSelection( this ); } + + @Override + public DomainResultProducer getDomainResultProducer() { + // could technically return an array I guess. See `SqmTuple` + throw new UnsupportedOperationException( ); + } } diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/select/SqmSelectStatement.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/select/SqmSelectStatement.java index 1682268df7..768ca25ba8 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/select/SqmSelectStatement.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/select/SqmSelectStatement.java @@ -20,7 +20,7 @@ import org.hibernate.query.criteria.JpaCriteriaQuery; import org.hibernate.query.criteria.JpaSelection; import org.hibernate.query.sqm.NodeBuilder; import org.hibernate.query.sqm.SqmQuerySource; -import org.hibernate.query.sqm.consume.spi.SemanticQueryWalker; +import org.hibernate.query.sqm.spi.SemanticQueryWalker; import org.hibernate.query.sqm.tree.SqmStatement; import org.hibernate.query.sqm.tree.expression.SqmExpression; import org.hibernate.query.sqm.tree.expression.SqmParameter; diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/select/SqmSelectableNode.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/select/SqmSelectableNode.java index 46674c4fcd..40b0fb97ab 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/select/SqmSelectableNode.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/select/SqmSelectableNode.java @@ -10,10 +10,8 @@ import java.util.function.Consumer; import javax.persistence.criteria.Selection; import org.hibernate.query.criteria.JpaSelection; -import org.hibernate.query.sqm.consume.spi.SemanticQueryWalker; import org.hibernate.query.sqm.tree.SqmTypedNode; import org.hibernate.query.sqm.tree.SqmVisitableNode; -import org.hibernate.sql.results.spi.DomainResult; import org.hibernate.sql.results.spi.DomainResultProducer; /** @@ -24,14 +22,9 @@ import org.hibernate.sql.results.spi.DomainResultProducer; */ public interface SqmSelectableNode extends JpaSelection, SqmTypedNode, SqmVisitableNode { /** - * The expectation is that the walking method for SqmSelectableNode - * will return some reference to a - * {@link DomainResultProducer} which can be - * used to generate a {@link DomainResult} - * for this selection in the SQM query + * Get the DomainResultProducer for this SqmSelectableNode */ - @Override - X accept(SemanticQueryWalker walker); + DomainResultProducer getDomainResultProducer(); /** * Visit each of this selectable's direct sub-selectables - used to diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/select/SqmSelection.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/select/SqmSelection.java index aa21202b89..080b67e838 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/select/SqmSelection.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/select/SqmSelection.java @@ -7,7 +7,7 @@ package org.hibernate.query.sqm.tree.select; import org.hibernate.query.sqm.NodeBuilder; -import org.hibernate.query.sqm.consume.spi.SemanticQueryWalker; +import org.hibernate.query.sqm.spi.SemanticQueryWalker; import org.hibernate.query.sqm.tree.AbstractSqmNode; import org.hibernate.query.sqm.tree.SqmVisitableNode; diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/select/SqmSubQuery.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/select/SqmSubQuery.java index 118b9d1d4b..581f1e14f2 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/select/SqmSubQuery.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/select/SqmSubQuery.java @@ -26,7 +26,7 @@ import org.hibernate.query.criteria.JpaSelection; import org.hibernate.query.criteria.JpaSubQuery; import org.hibernate.query.sqm.NodeBuilder; import org.hibernate.query.sqm.SqmExpressable; -import org.hibernate.query.sqm.consume.spi.SemanticQueryWalker; +import org.hibernate.query.sqm.spi.SemanticQueryWalker; import org.hibernate.query.sqm.tree.SqmQuery; import org.hibernate.query.sqm.tree.domain.SqmBagJoin; import org.hibernate.query.sqm.tree.domain.SqmListJoin; @@ -37,6 +37,7 @@ import org.hibernate.query.sqm.tree.expression.SqmExpression; import org.hibernate.query.sqm.tree.from.SqmRoot; import org.hibernate.query.sqm.tree.predicate.SqmInPredicate; import org.hibernate.query.sqm.tree.predicate.SqmPredicate; +import org.hibernate.sql.results.spi.DomainResultProducer; import org.hibernate.type.StandardBasicTypes; import org.hibernate.type.descriptor.java.JavaTypeDescriptor; @@ -311,4 +312,9 @@ public class SqmSubQuery extends AbstractSqmSelectQuery implements SqmSele public T1 accept(SemanticQueryWalker walker) { return walker.visitSubQueryExpression( this ); } + + @Override + public DomainResultProducer getDomainResultProducer() { + throw new NotYetImplementedFor6Exception( getClass() ); + } } diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/update/SqmUpdateStatement.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/update/SqmUpdateStatement.java index fdd64558b5..539c16135e 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/update/SqmUpdateStatement.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/update/SqmUpdateStatement.java @@ -20,7 +20,7 @@ import org.hibernate.query.criteria.JpaPredicate; import org.hibernate.query.sqm.NodeBuilder; import org.hibernate.query.sqm.internal.SqmCriteriaNodeBuilder; import org.hibernate.query.sqm.SqmQuerySource; -import org.hibernate.query.sqm.consume.spi.SemanticQueryWalker; +import org.hibernate.query.sqm.spi.SemanticQueryWalker; import org.hibernate.query.sqm.tree.AbstractSqmDmlStatement; import org.hibernate.query.sqm.tree.SqmDeleteOrUpdateStatement; import org.hibernate.query.sqm.tree.from.SqmRoot; diff --git a/hibernate-core/src/main/java/org/hibernate/sql/results/spi/DomainResultCreationState.java b/hibernate-core/src/main/java/org/hibernate/sql/results/spi/DomainResultCreationState.java index aa865f94d9..0301e8a452 100644 --- a/hibernate-core/src/main/java/org/hibernate/sql/results/spi/DomainResultCreationState.java +++ b/hibernate-core/src/main/java/org/hibernate/sql/results/spi/DomainResultCreationState.java @@ -18,7 +18,7 @@ import org.hibernate.sql.ast.spi.SqlAstCreationState; public interface DomainResultCreationState { SqlAstCreationState getSqlAstCreationState(); - default SqlAliasBaseManager getSAliasBaseManager() { + default SqlAliasBaseManager getSqlAliasBaseManager() { return getSqlAstCreationState().getSqlAliasBaseManager(); } diff --git a/hibernate-core/src/main/java/org/hibernate/sql/results/spi/DomainResultProducer.java b/hibernate-core/src/main/java/org/hibernate/sql/results/spi/DomainResultProducer.java index 0941ca7e79..b4a8626a74 100644 --- a/hibernate-core/src/main/java/org/hibernate/sql/results/spi/DomainResultProducer.java +++ b/hibernate-core/src/main/java/org/hibernate/sql/results/spi/DomainResultProducer.java @@ -6,7 +6,11 @@ */ package org.hibernate.sql.results.spi; +import java.util.function.Consumer; + import org.hibernate.NotYetImplementedFor6Exception; +import org.hibernate.persister.SqlExpressableType; +import org.hibernate.type.spi.TypeConfiguration; /** * Represents something that can produce a {@link DomainResult} @@ -16,6 +20,16 @@ import org.hibernate.NotYetImplementedFor6Exception; * @author Steve Ebersole */ public interface DomainResultProducer { + + /** + * Visit all of the SqlExpressableTypes associated with this this Readable. + * + * Used during cacheable SQL AST creation. + */ + default void visitJdbcTypes(Consumer action, TypeConfiguration typeConfiguration) { + throw new NotYetImplementedFor6Exception( getClass() ); + } + /** * Produce the domain query */ diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/query/hql/AliasCollisionTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/query/hql/AliasCollisionTest.java index daca77e170..b9a906e500 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/query/hql/AliasCollisionTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/query/hql/AliasCollisionTest.java @@ -10,7 +10,6 @@ import java.util.List; import org.hibernate.orm.test.query.sqm.BaseSqmUnitTest; import org.hibernate.query.sqm.AliasCollisionException; -import org.hibernate.query.sqm.produce.spi.ImplicitAliasGenerator; import org.hibernate.query.sqm.tree.domain.SqmSimplePath; import org.hibernate.query.sqm.tree.from.SqmRoot; import org.hibernate.query.sqm.tree.predicate.SqmComparisonPredicate; @@ -25,11 +24,11 @@ import org.hibernate.testing.orm.junit.ExpectedException; import org.junit.jupiter.api.Test; import static org.hamcrest.CoreMatchers.instanceOf; +import static org.hamcrest.CoreMatchers.nullValue; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; import static org.hibernate.testing.hamcrest.CollectionMatchers.hasSize; import static org.hibernate.testing.hamcrest.CollectionMatchers.isEmpty; -import static org.junit.jupiter.api.Assertions.assertTrue; /** * Test of all alias collision scenarios @@ -96,7 +95,7 @@ public class AliasCollisionTest extends BaseSqmUnitTest { final List selections = querySpec.getSelectClause().getSelections(); assertThat( selections, hasSize( 1 ) ); - assertTrue( ImplicitAliasGenerator.isImplicitAlias( selections.get( 0 ).getAlias() ) ); + assertThat( selections.get( 0 ).getAlias(), nullValue() ); final List roots = querySpec.getFromClause().getRoots(); assertThat( roots, hasSize( 1 ) ); @@ -125,7 +124,7 @@ public class AliasCollisionTest extends BaseSqmUnitTest { final List selections = querySpec.getSelectClause().getSelections(); assertThat( selections, hasSize( 1 ) ); - assertTrue( ImplicitAliasGenerator.isImplicitAlias( selections.get( 0 ).getAlias() ) ); + assertThat( selections.get( 0 ).getAlias(), nullValue() ); final List roots = querySpec.getFromClause().getRoots(); assertThat( roots, hasSize( 1 ) );