diff --git a/hibernate-core/src/main/java/org/hibernate/cfg/AnnotatedJoinColumn.java b/hibernate-core/src/main/java/org/hibernate/cfg/AnnotatedJoinColumn.java index ac5fd1d236..b516090675 100644 --- a/hibernate-core/src/main/java/org/hibernate/cfg/AnnotatedJoinColumn.java +++ b/hibernate-core/src/main/java/org/hibernate/cfg/AnnotatedJoinColumn.java @@ -205,9 +205,9 @@ public class AnnotatedJoinColumn extends AnnotatedColumn { } /** - * Build JoinColumn for a JOINED hierarchy + * Called for {@link jakarta.persistence.InheritanceType#JOINED} entities. */ - public static AnnotatedJoinColumn buildJoinColumn( + public static AnnotatedJoinColumn buildInheritanceJoinColumn( PrimaryKeyJoinColumn primaryKeyJoinColumn, JoinColumn joinColumn, Value identifier, @@ -216,11 +216,11 @@ public class AnnotatedJoinColumn extends AnnotatedColumn { final String defaultColumnName = context.getMetadataCollector() .getLogicalColumnName( identifier.getTable(), identifier.getColumns().get(0).getQuotedName() ); return primaryKeyJoinColumn != null || joinColumn != null - ? explicitJoinColumn( primaryKeyJoinColumn, joinColumn, parent, context, defaultColumnName ) - : implicitJoinColumn( parent, context, defaultColumnName ); + ? buildExplicitInheritanceJoinColumn( primaryKeyJoinColumn, joinColumn, parent, context, defaultColumnName ) + : buildImplicitInheritanceJoinColumn( parent, context, defaultColumnName ); } - private static AnnotatedJoinColumn explicitJoinColumn( + private static AnnotatedJoinColumn buildExplicitInheritanceJoinColumn( PrimaryKeyJoinColumn primaryKeyJoinColumn, JoinColumn joinColumn, AnnotatedJoinColumns parent, @@ -259,7 +259,7 @@ public class AnnotatedJoinColumn extends AnnotatedColumn { return column; } - private static AnnotatedJoinColumn implicitJoinColumn( + private static AnnotatedJoinColumn buildImplicitInheritanceJoinColumn( AnnotatedJoinColumns parent, MetadataBuildingContext context, String defaultColumnName ) { diff --git a/hibernate-core/src/main/java/org/hibernate/cfg/AnnotatedJoinColumns.java b/hibernate-core/src/main/java/org/hibernate/cfg/AnnotatedJoinColumns.java index 0e14863eb8..25ad64ff43 100644 --- a/hibernate-core/src/main/java/org/hibernate/cfg/AnnotatedJoinColumns.java +++ b/hibernate-core/src/main/java/org/hibernate/cfg/AnnotatedJoinColumns.java @@ -170,6 +170,9 @@ public class AnnotatedJoinColumns extends AnnotatedColumns { return parent; } + /** + * Called for join tables in {@link jakarta.persistence.ManyToMany} associations. + */ public static AnnotatedJoinColumns buildJoinTableJoinColumns( JoinColumn[] joinColumns, Map secondaryTables, diff --git a/hibernate-core/src/main/java/org/hibernate/cfg/annotations/EntityBinder.java b/hibernate-core/src/main/java/org/hibernate/cfg/annotations/EntityBinder.java index 31d7e42fb8..df2d20d146 100644 --- a/hibernate-core/src/main/java/org/hibernate/cfg/annotations/EntityBinder.java +++ b/hibernate-core/src/main/java/org/hibernate/cfg/annotations/EntityBinder.java @@ -138,7 +138,7 @@ import org.hibernate.persister.entity.EntityPersister; import org.jboss.logging.Logger; import static org.hibernate.cfg.AnnotatedDiscriminatorColumn.buildDiscriminatorColumn; -import static org.hibernate.cfg.AnnotatedJoinColumn.buildJoinColumn; +import static org.hibernate.cfg.AnnotatedJoinColumn.buildInheritanceJoinColumn; import static org.hibernate.cfg.BinderHelper.getMappedSuperclassOrNull; import static org.hibernate.cfg.BinderHelper.getOverridableAnnotation; import static org.hibernate.cfg.BinderHelper.hasToOneAnnotation; @@ -937,7 +937,7 @@ public class EntityBinder { final PrimaryKeyJoinColumn[] columns = primaryKeyJoinColumns.value(); if ( columns.length > 0 ) { for ( PrimaryKeyJoinColumn column : columns ) { - buildJoinColumn( + buildInheritanceJoinColumn( column, null, superEntity.getIdentifier(), @@ -947,7 +947,7 @@ public class EntityBinder { } } else { - buildJoinColumn( + buildInheritanceJoinColumn( clazzToProcess.getAnnotation( PrimaryKeyJoinColumn.class ), null, superEntity.getIdentifier(), @@ -957,7 +957,7 @@ public class EntityBinder { } } else { - buildJoinColumn( + buildInheritanceJoinColumn( clazzToProcess.getAnnotation( PrimaryKeyJoinColumn.class ), null, superEntity.getIdentifier(), @@ -1689,7 +1689,7 @@ public class EntityBinder { joinColumns.setBuildingContext( context ); joinColumns.setJoins( secondaryTables ); joinColumns.setPropertyHolder( propertyHolder ); - buildJoinColumn( + buildInheritanceJoinColumn( null, null, persistentClass.getIdentifier(), @@ -1715,7 +1715,7 @@ public class EntityBinder { for ( int colIndex = 0; colIndex < joinColumnCount; colIndex++ ) { final PrimaryKeyJoinColumn primaryKeyJoinColumn = primaryKeyJoinColumns != null ? primaryKeyJoinColumns[colIndex] : null; final JoinColumn joinColumn = joinColumns != null ? joinColumns[colIndex] : null; - buildJoinColumn( + buildInheritanceJoinColumn( primaryKeyJoinColumn, joinColumn, persistentClass.getIdentifier(),