Skip to content

Commit 36a3ff4

Browse files
committed
JavaDoc
1 parent 74d3708 commit 36a3ff4

File tree

1 file changed

+31
-6
lines changed
  • spring-data-relational/src/main/java/org/springframework/data/relational/core/mapping

1 file changed

+31
-6
lines changed

spring-data-relational/src/main/java/org/springframework/data/relational/core/mapping/AggregatePath.java

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ static TableInfo of(AggregatePath path) {
283283

284284
SqlIdentifier tableAlias = tableOwner.isRoot() ? null : AggregatePathTableUtils.constructTableAlias(tableOwner);
285285

286-
ColumnInfos reverseColumnInfos = computeReverseColumnInfo(path);
286+
ColumnInfos backReferenceColumnInfos = computeBackReferenceColumnInfos(path);
287287

288288
ColumnInfo qualifierColumnInfo = null;
289289
if (!path.isRoot()) {
@@ -301,7 +301,7 @@ static TableInfo of(AggregatePath path) {
301301

302302
ColumnInfos idColumnInfos = computeIdColumnInfos(tableOwner, leafEntity);
303303

304-
return new TableInfo(qualifiedTableName, tableAlias, reverseColumnInfos, qualifierColumnInfo, qualifierColumnType,
304+
return new TableInfo(qualifiedTableName, tableAlias, backReferenceColumnInfos, qualifierColumnInfo, qualifierColumnType,
305305
idColumnInfos);
306306

307307
}
@@ -331,7 +331,7 @@ private static ColumnInfos computeIdColumnInfos(AggregatePath tableOwner,
331331
}
332332
}
333333

334-
private static ColumnInfos computeReverseColumnInfo(AggregatePath path) {
334+
private static ColumnInfos computeBackReferenceColumnInfos(AggregatePath path) {
335335

336336
AggregatePath tableOwner = AggregatePathTraversal.getTableOwningPath(path);
337337

@@ -386,19 +386,43 @@ private static ColumnInfos computeReverseColumnInfo(AggregatePath path) {
386386

387387
}
388388

389+
@Override
390+
public ColumnInfos backReferenceColumnInfos() {
391+
return backReferenceColumnInfos;
392+
}
393+
394+
/**
395+
* Returns the unique {@link ColumnInfo} referencing the parent table, if such exists.
396+
*
397+
* @return guaranteed not to be {@literal null}.
398+
* @throws IllegalStateException if there is not exactly one back referencing column.
399+
* @deprecated since there might be more than one reverse column instead. Use {@link #backReferenceColumnInfos()} instead.
400+
*/
389401
@Deprecated(forRemoval = true)
390402
public ColumnInfo reverseColumnInfo() {
391403
return backReferenceColumnInfos.unique();
392404
}
393405

406+
/**
407+
* The id columns of the underlying table.
408+
* <p>
409+
* These might be:
410+
* <ul><li>the columns representing the id of the entity in question.
411+
* </li><li> the columns representing the id of a parent entity, which _owns_ the table. Note that this case also covers the first case.
412+
* </li><li> or the backReferenceColumns.
413+
* </li></ul>
414+
*
415+
* @return ColumnInfos representing the effective id of this entity. Guaranteed not to be {@literal null}.
416+
*/
394417
public ColumnInfos effectiveIdColumnInfos() {
395418
return backReferenceColumnInfos.columnInfos.isEmpty() ? idColumnInfos : backReferenceColumnInfos;
396419
}
397420
}
398421

399422
/**
400-
* @param name The name of the column used to represent this property in the database.
401-
* @param alias The alias for the column used to represent this property in the database.
423+
* @param name the name of the column used to represent this property in the database.
424+
* @param alias the alias for the column used to represent this property in the database.
425+
* @since 3.2
402426
*/
403427
record ColumnInfo(SqlIdentifier name, SqlIdentifier alias) {
404428

@@ -431,7 +455,8 @@ static ColumnInfo of(AggregatePath path) {
431455
* ids and references to such ids.
432456
*
433457
* @author Jens Schauder
434-
**/
458+
* @since 3.5
459+
*/
435460
class ColumnInfos {
436461

437462
private final AggregatePath basePath;

0 commit comments

Comments
 (0)