diff --git a/documentation/src/main/asciidoc/userguide/chapters/query/hql/QueryLanguage.adoc b/documentation/src/main/asciidoc/userguide/chapters/query/hql/QueryLanguage.adoc index 41d7754fdcd5..b437d37ec717 100644 --- a/documentation/src/main/asciidoc/userguide/chapters/query/hql/QueryLanguage.adoc +++ b/documentation/src/main/asciidoc/userguide/chapters/query/hql/QueryLanguage.adoc @@ -1473,7 +1473,7 @@ See <> for mor [[hql-derived-root]] ==== Derived root -As of Hibernate 6.1, HQL allows to declare derived roots, based on a sub query in the `from` clause. +As of Hibernate 6.1, HQL allows to declare derived roots, based on a subquery in the `from` clause. [[hql-derived-root-example]] ==== diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/HANASqlAstTranslator.java b/hibernate-core/src/main/java/org/hibernate/dialect/HANASqlAstTranslator.java index 7f6f2399ed2d..a1ad94c5aabd 100644 --- a/hibernate-core/src/main/java/org/hibernate/dialect/HANASqlAstTranslator.java +++ b/hibernate-core/src/main/java/org/hibernate/dialect/HANASqlAstTranslator.java @@ -78,7 +78,7 @@ public void visitQueryPartTableReference(QueryPartTableReference tableReference) @Override protected SqlAstNodeRenderingMode getParameterRenderingMode() { - // HANA does not support parameters in lateral sub queries for some reason, so inline all the parameters in this case + // HANA does not support parameters in lateral subqueries for some reason, so inline all the parameters in this case return inLateral ? SqlAstNodeRenderingMode.INLINE_ALL_PARAMETERS : super.getParameterRenderingMode(); } diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/function/AggregateWindowEmulationQueryTransformer.java b/hibernate-core/src/main/java/org/hibernate/dialect/function/AggregateWindowEmulationQueryTransformer.java index b4514ff095eb..78fd84d39147 100644 --- a/hibernate-core/src/main/java/org/hibernate/dialect/function/AggregateWindowEmulationQueryTransformer.java +++ b/hibernate-core/src/main/java/org/hibernate/dialect/function/AggregateWindowEmulationQueryTransformer.java @@ -111,7 +111,7 @@ public QuerySpec transform( // for group by items, since these group by items are migrated to the outer query final Map selectionMapping = new HashMap<>( subSelections.size() ); // Create the expressions/selections for the outer query and the columnNames list - // for the QueryPartTableGroup within which the sub query spec is embedded + // for the QueryPartTableGroup within which the subquery spec is embedded for ( int i = 0; i < subSelections.size(); i++ ) { final BasicValuedMapping mapping = (BasicValuedMapping) subSelections.get( i ) .getExpressionType(); @@ -352,7 +352,7 @@ protected X replaceExpression(X expression) { subQuerySpec.getSortSpecifications().clear(); } - // We need to add selection items for the expressions we order by to the sub query spec. + // We need to add selection items for the expressions we order by to the subquery spec. final int selectionOffset = columnNames.size(); // Collect the sorting column references so we can apply the filter later final List sortingColumns = new ArrayList<>( withinGroup.size() ); diff --git a/hibernate-core/src/main/java/org/hibernate/query/criteria/JpaDerivedFrom.java b/hibernate-core/src/main/java/org/hibernate/query/criteria/JpaDerivedFrom.java index cc746be78671..56b7611fdd3e 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/criteria/JpaDerivedFrom.java +++ b/hibernate-core/src/main/java/org/hibernate/query/criteria/JpaDerivedFrom.java @@ -15,13 +15,13 @@ public interface JpaDerivedFrom extends JpaFrom { /** - * The sub query part for this derived from node. + * The subquery part for this derived from node. */ JpaSubQuery getQueryPart(); /** - * Specifies whether the sub query part can access previous from node aliases. - * Normally, sub queries in the from clause are unable to access other from nodes, + * Specifies whether the subquery part can access previous from node aliases. + * Normally, subqueries in the from clause are unable to access other from nodes, * but when specifying them as lateral, they are allowed to do so. * Refer to the SQL standard definition of LATERAL for more details. */ diff --git a/hibernate-core/src/main/java/org/hibernate/query/criteria/JpaSelectCriteria.java b/hibernate-core/src/main/java/org/hibernate/query/criteria/JpaSelectCriteria.java index bcbd770fcf1d..13b91f8a75ce 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/criteria/JpaSelectCriteria.java +++ b/hibernate-core/src/main/java/org/hibernate/query/criteria/JpaSelectCriteria.java @@ -30,31 +30,31 @@ public interface JpaSelectCriteria extends AbstractQuery, JpaCriteriaBase JpaQueryPart getQueryPart(); /** - * Create and add a query root corresponding to the given sub query, + * Create and add a query root corresponding to the given subquery, * forming a cartesian product with any existing roots. * - * @param subquery the sub query - * @return query root corresponding to the given sub query + * @param subquery the subquery + * @return query root corresponding to the given subquery */ JpaDerivedRoot from(Subquery subquery); /** - * Create and add a query root corresponding to the given lateral sub query, + * Create and add a query root corresponding to the given lateral subquery, * forming a cartesian product with any existing roots. * - * @param subquery the sub query - * @return query root corresponding to the given sub query + * @param subquery the subquery + * @return query root corresponding to the given subquery */ JpaDerivedRoot fromLateral(Subquery subquery); /** - * Create and add a query root corresponding to the given sub query, + * Create and add a query root corresponding to the given subquery, * forming a cartesian product with any existing roots. - * If the sub query is marked as lateral, it may access previous from elements. + * If the subquery is marked as lateral, it may access previous from elements. * - * @param subquery the sub query - * @param lateral whether to allow access to previous from elements in the sub query - * @return query root corresponding to the given sub query + * @param subquery the subquery + * @param lateral whether to allow access to previous from elements in the subquery + * @return query root corresponding to the given subquery */ JpaDerivedRoot from(Subquery subquery, boolean lateral); diff --git a/hibernate-core/src/main/java/org/hibernate/query/derived/AnonymousTupleType.java b/hibernate-core/src/main/java/org/hibernate/query/derived/AnonymousTupleType.java index 14d508b810fa..3d45d870c578 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/derived/AnonymousTupleType.java +++ b/hibernate-core/src/main/java/org/hibernate/query/derived/AnonymousTupleType.java @@ -62,10 +62,10 @@ public AnonymousTupleType(SqmSelectableNode[] components) { private static SqmSelectableNode[] extractSqmExpressibles(SqmSubQuery subQuery) { final SqmSelectClause selectClause = subQuery.getQuerySpec().getSelectClause(); if ( selectClause == null || selectClause.getSelectionItems().isEmpty() ) { - throw new IllegalArgumentException( "Sub query has no selection items!" ); + throw new IllegalArgumentException( "subquery has no selection items!" ); } - // todo: right now, we "snapshot" the state of the sub query when creating this type, but maybe we shouldn't? - // i.e. what if the sub query changes later on? Or should we somehow mark the sub query to signal, + // todo: right now, we "snapshot" the state of the subquery when creating this type, but maybe we shouldn't? + // i.e. what if the subquery changes later on? Or should we somehow mark the subquery to signal, // that changes to the select clause are invalid after a certain point? return selectClause.getSelectionItems().toArray( SqmSelectableNode[]::new ); } 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 135d5d2114b5..b0a90d239e06 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 @@ -68,7 +68,7 @@ protected void validateAsRoot(SqmFrom pathRoot) { return; } } - // If the current join is not part of the processing query, this must be a sub query in the ON clause + // If the current join is not part of the processing query, this must be a subquery in the ON clause // in which case the path root is allowed to occur in the current processing query as root if ( currentProcessingQuery instanceof SqmSubQuery ) { validateAsRootOnParentQueryClosure( pathRoot, root, processingState ); @@ -96,7 +96,7 @@ private void validateAsRootOnParentQueryClosure( if ( processingQuery instanceof SqmSelectQuery ) { final SqmQuerySpec querySpec = ( (SqmSelectQuery) processingQuery ).getQuerySpec(); final SqmFromClause fromClause = querySpec.getFromClause(); - // If we are in a sub query, the "foreign" from element could be one of the sub query roots, + // If we are in a subquery, the "foreign" from element could be one of the subquery roots, // which is totally fine. The aim of this check is to prevent uses of different "spaces" // i.e. `from A a, B b join b.id = a.id` would be illegal if ( fromClause != null && fromClause.getRoots().contains( root ) ) { diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/sql/BaseSqmToSqlAstConverter.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/sql/BaseSqmToSqlAstConverter.java index 1fb1d3e086dc..567f01866142 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/sql/BaseSqmToSqlAstConverter.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/sql/BaseSqmToSqlAstConverter.java @@ -5948,7 +5948,7 @@ private ModifiedSubQueryExpression.Modifier convert(SqmModifiedSubQueryExpressio @Override public QueryPart visitSubQueryExpression(SqmSubQuery sqmSubQuery) { // The only purpose for tracking the current join is to - // Reset the current join for sub queries because in there, we won't add nested joins + // Reset the current join for subqueries because in there, we won't add nested joins final SqmJoin oldJoin = currentlyProcessingJoin; currentlyProcessingJoin = null; final QueryPart queryPart = visitQueryPart( sqmSubQuery.getQueryPart() ); diff --git a/hibernate-core/src/main/java/org/hibernate/sql/ast/spi/AbstractSqlAstTranslator.java b/hibernate-core/src/main/java/org/hibernate/sql/ast/spi/AbstractSqlAstTranslator.java index 253dfbd37364..57ecfeab6ca7 100644 --- a/hibernate-core/src/main/java/org/hibernate/sql/ast/spi/AbstractSqlAstTranslator.java +++ b/hibernate-core/src/main/java/org/hibernate/sql/ast/spi/AbstractSqlAstTranslator.java @@ -1554,7 +1554,7 @@ public void visitQuerySpec(QuerySpec querySpec) { appendSql( "select" ); appendSql( queryGroupAlias ); appendSql( ".* from " ); - // We need to assign aliases when we render a query spec as sub query to avoid clashing aliases + // We need to assign aliases when we render a query spec as subquery to avoid clashing aliases this.needsSelectAliases = this.needsSelectAliases || hasDuplicateSelectItems( querySpec ); } else if ( !supportsDuplicateSelectItemsInQueryGroup() ) { @@ -5036,7 +5036,7 @@ protected void emulateSubQueryRelationalRestrictionPredic if ( queryPart instanceof QuerySpec && queryPart.getFetchClauseExpression() == null && queryPart.getOffsetClauseExpression() == null ) { subQuery = (QuerySpec) queryPart; - // We can only emulate the tuple sub query predicate as exists predicate when there are no limit/offsets + // We can only emulate the tuple subquery predicate as exists predicate when there are no limit/offsets if ( negated ) { appendSql( "not " ); } @@ -5130,7 +5130,7 @@ protected void emulateQuantifiedTupleSubQueryPredicate( final QuerySpec subQuery; if ( queryPart instanceof QuerySpec && queryPart.getFetchClauseExpression() == null && queryPart.getOffsetClauseExpression() == null ) { subQuery = (QuerySpec) queryPart; - // We can only emulate the tuple sub query predicate comparing against the top element when there are no limit/offsets + // We can only emulate the tuple subquery predicate comparing against the top element when there are no limit/offsets lhsTuple.accept( this ); appendSql( tupleComparisonOperator.sqlText() ); @@ -5409,7 +5409,7 @@ else if ( subquery != null && !supportsRowValueConstructorSyntaxInQuantifiedPred } } // If we get here, this is an equality-like comparison, though we support scalar row value comparison - // For this special case, we can rely on scalar sub query handling, given that the sub query fetches only one row + // For this special case, we can rely on scalar subquery handling, given that the subquery fetches only one row if ( isFetchFirstRowOnly( subquery ) ) { renderComparison( lhsTuple, operator, subquery ); return; diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/query/SubQueryInFromEmbeddedIdTests.java b/hibernate-core/src/test/java/org/hibernate/orm/test/query/SubQueryInFromEmbeddedIdTests.java index 2c9f92b6f4b0..2b9c129597ff 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/query/SubQueryInFromEmbeddedIdTests.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/query/SubQueryInFromEmbeddedIdTests.java @@ -54,7 +54,7 @@ public class SubQueryInFromEmbeddedIdTests { @Test - @FailureExpected(reason = "Support for embedded id association selecting in from clause sub queries not yet supported") + @FailureExpected(reason = "Support for embedded id association selecting in from clause subqueries not yet supported") public void testEntity(SessionFactoryScope scope) { scope.inTransaction( session -> { @@ -100,7 +100,7 @@ public void testEntity(SessionFactoryScope scope) { } @Test - @FailureExpected(reason = "Support for embedded id association selecting in from clause sub queries not yet supported") + @FailureExpected(reason = "Support for embedded id association selecting in from clause subqueries not yet supported") public void testEntityJoin(SessionFactoryScope scope) { scope.inTransaction( session -> { @@ -145,7 +145,7 @@ public void testEntityJoin(SessionFactoryScope scope) { } @Test - @FailureExpected(reason = "Support for embedded id association selecting in from clause sub queries not yet supported") + @FailureExpected(reason = "Support for embedded id association selecting in from clause subqueries not yet supported") public void testEntityImplicit(SessionFactoryScope scope) { scope.inTransaction( session -> { diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/query/SubQueryInFromIdClassTests.java b/hibernate-core/src/test/java/org/hibernate/orm/test/query/SubQueryInFromIdClassTests.java index 0fffe0df22f6..4bbae495c390 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/query/SubQueryInFromIdClassTests.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/query/SubQueryInFromIdClassTests.java @@ -53,7 +53,7 @@ public class SubQueryInFromIdClassTests { @Test - @FailureExpected(reason = "Support for id class association selecting in from clause sub queries not yet supported") + @FailureExpected(reason = "Support for id class association selecting in from clause subqueries not yet supported") public void testEntity(SessionFactoryScope scope) { scope.inTransaction( session -> { @@ -99,7 +99,7 @@ public void testEntity(SessionFactoryScope scope) { } @Test - @FailureExpected(reason = "Support for id class association selecting in from clause sub queries not yet supported") + @FailureExpected(reason = "Support for id class association selecting in from clause subqueries not yet supported") public void testEntityJoin(SessionFactoryScope scope) { scope.inTransaction( session -> { @@ -144,7 +144,7 @@ public void testEntityJoin(SessionFactoryScope scope) { } @Test - @FailureExpected(reason = "Support for id class association selecting in from clause sub queries not yet supported") + @FailureExpected(reason = "Support for id class association selecting in from clause subqueries not yet supported") public void testEntityImplicit(SessionFactoryScope scope) { scope.inTransaction( session -> { diff --git a/hibernate-testing/src/main/java/org/hibernate/testing/DialectChecks.java b/hibernate-testing/src/main/java/org/hibernate/testing/DialectChecks.java index 342d35a726b9..77be77430049 100644 --- a/hibernate-testing/src/main/java/org/hibernate/testing/DialectChecks.java +++ b/hibernate-testing/src/main/java/org/hibernate/testing/DialectChecks.java @@ -291,7 +291,7 @@ public boolean isMatch(Dialect dialect) { public static class SupportsOrderByInCorrelatedSubquery implements DialectCheck { public boolean isMatch(Dialect dialect) { return dialect.supportsOrderByInSubquery() - // For some reason, HANA doesn't support order by in correlated sub queries... + // For some reason, HANA doesn't support order by in correlated subqueries... && !( dialect instanceof AbstractHANADialect ); } } diff --git a/hibernate-testing/src/main/java/org/hibernate/testing/orm/junit/DialectFeatureChecks.java b/hibernate-testing/src/main/java/org/hibernate/testing/orm/junit/DialectFeatureChecks.java index 6790dc86e8a7..1024ef7938b0 100644 --- a/hibernate-testing/src/main/java/org/hibernate/testing/orm/junit/DialectFeatureChecks.java +++ b/hibernate-testing/src/main/java/org/hibernate/testing/orm/junit/DialectFeatureChecks.java @@ -359,7 +359,7 @@ public boolean apply(Dialect dialect) { public static class SupportsOrderByInCorrelatedSubquery implements DialectFeatureCheck { public boolean apply(Dialect dialect) { return dialect.supportsOrderByInSubquery() - // For some reason, HANA doesn't support order by in correlated sub queries... + // For some reason, HANA doesn't support order by in correlated subqueries... && !( dialect instanceof AbstractHANADialect ); } }