@@ -113,7 +113,7 @@ private static List<Expression> getSelectList(QueryMeta queryMeta, List<QueryMet
113113 }
114114
115115 private InlineQuery createMainSelect (List <Expression > columns , AggregatePath rootPath , InlineQuery rootQuery ,
116- List <QueryMeta > inlineQueries ) {
116+ List <QueryMeta > inlineQueries ) {
117117
118118 SelectBuilder .SelectJoin select = StatementBuilder .select (columns ).from (rootQuery );
119119 select = applyJoins (rootPath , inlineQueries , select );
@@ -127,7 +127,7 @@ private InlineQuery createMainSelect(List<Expression> columns, AggregatePath roo
127127 *
128128 * @param paths the paths to consider.
129129 * @return a {@link Map} that contains all the inline queries indexed by the path to the entity that gets loaded by
130- * the subquery.
130+ * the subquery.
131131 */
132132 private List <QueryMeta > createInlineQueries (PersistentPropertyPaths <?, RelationalPersistentProperty > paths ) {
133133
@@ -149,7 +149,7 @@ private List<QueryMeta> createInlineQueries(PersistentPropertyPaths<?, Relationa
149149 * that are not unique across tables and also the generated SQL doesn't contain quotes and funny column names, making
150150 * them easier to understand and also potentially shorter.
151151 *
152- * @param basePath the path for which to create the inline query.
152+ * @param basePath the path for which to create the inline query.
153153 * @param condition a condition that is to be applied to the query. May be {@literal null}.
154154 * @return an inline query for the given path.
155155 */
@@ -169,11 +169,8 @@ private QueryMeta createInlineQuery(AggregatePath basePath, @Nullable Condition
169169 String rowCountAlias = aliases .getRowCountAlias (basePath );
170170 Expression count = basePath .isRoot () ? new AliasedExpression (SQL .literalOf (1 ), rowCountAlias ) //
171171 : AnalyticFunction .create ("count" , Expressions .just ("*" )) //
172- .partitionBy ( //
173- basePath .getTableInfo ().backReferenceColumnInfos ().toList ( //
174- ci -> table .column (ci .name ()) //
175- ) //
176- ).as (rowCountAlias );
172+ .partitionBy (basePath .getTableInfo ().backReferenceColumnInfos ().toColumnList (table ) //
173+ ).as (rowCountAlias );
177174 columns .add (count );
178175
179176 String backReferenceAlias = null ;
@@ -241,25 +238,25 @@ private String getIdentifierProperty(List<AggregatePath> paths) {
241238 }
242239
243240 private static AnalyticFunction createRowNumberExpression (AggregatePath basePath , Table table ,
244- String rowNumberAlias ) {
241+ String rowNumberAlias ) {
245242 AggregatePath .ColumnInfos reverseColumnInfos = basePath .getTableInfo ().backReferenceColumnInfos ();
246243 return AnalyticFunction .create ("row_number" ) //
247- .partitionBy (reverseColumnInfos .toList ( ci -> table . column ( ci . name ()) )) //
248- .orderBy (reverseColumnInfos .toList ( ci -> table . column ( ci . name ()) )) //
244+ .partitionBy (reverseColumnInfos .toColumnList ( table )) //
245+ .orderBy (reverseColumnInfos .toColumnList ( table )) //
249246 .as (rowNumberAlias );
250247 }
251248
252249 /**
253250 * Adds joins to a select.
254251 *
255- * @param rootPath the AggregatePath that gets selected by the select in question.
252+ * @param rootPath the AggregatePath that gets selected by the select in question.
256253 * @param inlineQueries all the inline queries to added as joins as returned by
257- * {@link #createInlineQueries(PersistentPropertyPaths)}
258- * @param select the select to modify.
254+ * {@link #createInlineQueries(PersistentPropertyPaths)}
255+ * @param select the select to modify.
259256 * @return the original select but with added joins
260257 */
261258 private SelectBuilder .SelectJoin applyJoins (AggregatePath rootPath , List <QueryMeta > inlineQueries ,
262- SelectBuilder .SelectJoin select ) {
259+ SelectBuilder .SelectJoin select ) {
263260
264261 RelationalPersistentProperty rootIdProperty = rootPath .getRequiredIdProperty ();
265262 AggregatePath rootIdPath = rootPath .append (rootIdProperty );
@@ -286,12 +283,12 @@ private SelectBuilder.SelectJoin applyJoins(AggregatePath rootPath, List<QueryMe
286283 * </ol>
287284 *
288285 * @param inlineQueries all in the inline queries for all the children, as returned by
289- * {@link #createInlineQueries(PersistentPropertyPaths)}
290- * @param select the select to which the where clause gets added.
286+ * {@link #createInlineQueries(PersistentPropertyPaths)}
287+ * @param select the select to which the where clause gets added.
291288 * @return the modified select.
292289 */
293290 private SelectBuilder .SelectOrdered applyWhereCondition (List <QueryMeta > inlineQueries ,
294- SelectBuilder .SelectJoin select ) {
291+ SelectBuilder .SelectJoin select ) {
295292
296293 SelectBuilder .SelectWhere selectWhere = (SelectBuilder .SelectWhere ) select ;
297294
@@ -389,8 +386,8 @@ public AliasFactory getAliasFactory() {
389386 * </table>
390387 *
391388 * @param rowNumberAlias the alias of the rownumber column of the subselect under consideration. This determines if
392- * the other value is replaced by null or not.
393- * @param alias the column potentially to be replaced by null
389+ * the other value is replaced by null or not.
390+ * @param alias the column potentially to be replaced by null
394391 * @return a SQL expression.
395392 */
396393 private static Expression filteredColumnExpression (String rowNumberAlias , String alias ) {
@@ -422,11 +419,12 @@ private static SimpleFunction greatest(List<Expression> expressions) {
422419 }
423420
424421 record QueryMeta (AggregatePath basePath , InlineQuery inlineQuery , Collection <Expression > simpleColumns ,
425- Collection <Expression > selectableExpressions , Expression id , Expression backReference , Expression key ,
426- Expression rowNumber , Expression rowCount ) {
422+ Collection <Expression > selectableExpressions , Expression id , Expression backReference ,
423+ Expression key ,
424+ Expression rowNumber , Expression rowCount ) {
427425
428426 static QueryMeta of (AggregatePath basePath , InlineQuery inlineQuery , Collection <Expression > simpleColumns ,
429- Expression id , Expression backReference , Expression key , Expression rowNumber , Expression rowCount ) {
427+ Expression id , Expression backReference , Expression key , Expression rowNumber , Expression rowCount ) {
430428
431429 List <Expression > selectableExpressions = new ArrayList <>(simpleColumns );
432430 selectableExpressions .add (rowNumber );
0 commit comments