@@ -264,53 +264,52 @@ private SelectBuilder.SelectJoin selectBuilder(Table table) {
264
264
265
265
Predicate <AggregatePath > filter = ap -> returnedType .needsCustomConstruction () && !returnedType .getInputProperties ().contains (ap .getRequiredBaseProperty ().getName ());
266
266
267
- // sqlGeneratorSource.getSqlGenerator(entity.getType()).createSelectBuilder(
267
+ return (SelectBuilder .SelectJoin ) sqlGeneratorSource .getSqlGenerator (entity .getType ()).createSelectBuilder (
268
+ filter
269
+ , table );
268
270
//
269
- // , table)
270
-
271
- SqlContext sqlContext = new SqlContext ();
272
-
273
- List <Join > joinTables = new ArrayList <>();
274
- for (PersistentPropertyPath <RelationalPersistentProperty > path : context
275
- .findPersistentPropertyPaths (entity .getType (), p -> true )) {
276
-
277
- AggregatePath aggregatePath = context .getAggregatePath (path );
278
-
279
- // TODO: special handling for custom construction?
280
- if (filter .test (aggregatePath )) { continue ;}
281
-
282
- // add a join if necessary
283
- Join join = getJoin (sqlContext , aggregatePath );
284
- if (join != null ) {
285
- joinTables .add (join );
286
- }
287
-
288
- Column column = getColumn (sqlContext , aggregatePath );
289
- if (column != null ) {
290
- columnExpressions .add (column );
291
- }
292
- }
293
-
294
- SelectBuilder .SelectJoin baseSelect = StatementBuilder .select (columnExpressions ).from (table );
295
-
296
- // TODO: included in SqlGenerator.Join
297
- for (Join join : joinTables ) {
298
-
299
- Condition condition = null ;
300
-
301
- for (int i = 0 ; i < join .joinColumns .size (); i ++) {
302
- Column parentColumn = join .parentId .get (i );
303
- Column joinColumn = join .joinColumns .get (i );
304
- Comparison singleCondition = joinColumn .isEqualTo (parentColumn );
305
- condition = condition == null ? singleCondition : condition .and (singleCondition );
306
- }
307
-
308
- Assert .state (condition != null , "No condition found" );
309
-
310
- baseSelect = baseSelect .leftOuterJoin (join .joinTable ).on (condition );
311
- }
312
-
313
- return baseSelect ;
271
+ // SqlContext sqlContext = new SqlContext();
272
+ //
273
+ // List<Join> joinTables = new ArrayList<>();
274
+ // for (PersistentPropertyPath<RelationalPersistentProperty> path : context
275
+ // .findPersistentPropertyPaths(entity.getType(), p -> true)) {
276
+ //
277
+ // AggregatePath aggregatePath = context.getAggregatePath(path);
278
+ //
279
+ // if (filter.test(aggregatePath)) { continue;}
280
+ //
281
+ // // add a join if necessary
282
+ // Join join = getJoin(sqlContext, aggregatePath);
283
+ // if (join != null) {
284
+ // joinTables.add(join);
285
+ // }
286
+ //
287
+ // Column column = getColumn(sqlContext, aggregatePath);
288
+ // if (column != null) {
289
+ // columnExpressions.add(column);
290
+ // }
291
+ // }
292
+ //
293
+ // SelectBuilder.SelectJoin baseSelect = StatementBuilder.select(columnExpressions).from(table);
294
+ //
295
+ // // TODO: included in SqlGenerator.Join
296
+ // for (Join join : joinTables) {
297
+ //
298
+ // Condition condition = null;
299
+ //
300
+ // for (int i = 0; i < join.joinColumns.size(); i++) {
301
+ // Column parentColumn = join.parentId.get(i);
302
+ // Column joinColumn = join.joinColumns.get(i);
303
+ // Comparison singleCondition = joinColumn.isEqualTo(parentColumn);
304
+ // condition = condition == null ? singleCondition : condition.and(singleCondition);
305
+ // }
306
+ //
307
+ // Assert.state(condition != null, "No condition found");
308
+ //
309
+ // baseSelect = baseSelect.leftOuterJoin(join.joinTable).on(condition);
310
+ // }
311
+ //
312
+ // return baseSelect;
314
313
}
315
314
316
315
/**
0 commit comments