Class ManyToManyFieldResolver

java.lang.Object
io.github.blyznytsiaorg.bibernate.ddl.field.ManyToManyFieldResolver
All Implemented Interfaces:
FieldResolver

public class ManyToManyFieldResolver extends Object implements FieldResolver
The ManyToManyFieldResolver class implements the FieldResolver interface to handle Many-to-Many relationships defined in entity classes. It generates necessary Data Definition Language (DDL) queries for creating join tables and foreign key constraints.
Since:
1.0
Author:
Blyzhnytsia Team
See Also:
  • Field Details

  • Constructor Details

    • ManyToManyFieldResolver

      public ManyToManyFieldResolver()
  • Method Details

    • hasFieldToResolve

      public boolean hasFieldToResolve(EntityColumnDetails entityColumnDetails)
      Determines whether the given entity column represents a Many-to-Many relationship.
      Specified by:
      hasFieldToResolve in interface FieldResolver
      Parameters:
      entityColumnDetails - the details of the entity column
      Returns:
      true if the column represents a Many-to-Many relationship, otherwise false
    • handleField

      public void handleField(DDLFieldMetadataHolder metadataHolder, Map<Integer,List<String>> ddlMetadata)
      Handles the Many-to-Many field by creating the necessary DDL queries.
      Specified by:
      handleField in interface FieldResolver
      Parameters:
      metadataHolder - the holder containing metadata information
      ddlMetadata - the DDL metadata map
    • processForeignKeyConstraintJoinColumn

      private void processForeignKeyConstraintJoinColumn(Set<String> foreignNameConstraints, String tableName, String foreignKey, String joinTableName, String joinColumnName, Map<Integer,List<String>> ddlMetadata)
      Processes the creation of a foreign key constraint for the join column in a Many-to-Many relationship.
      Parameters:
      foreignNameConstraints - the set containing the names of existing foreign key constraints
      tableName - the name of the table containing the join column
      foreignKey - the name of the foreign key constraint
      joinTableName - the name of the join table
      joinColumnName - the name of the join column
      ddlMetadata - the metadata map for storing DDL queries
    • processForeignKeyConstraintInverseJoinColumn

      private void processForeignKeyConstraintInverseJoinColumn(String foreignKey, Set<String> foreignNameConstraints, String joinTableName, EntityMetadata relationEntityMetadata, String inverseJoinColumnName, Map<Integer,List<String>> ddlMetadata)
      Processes the creation of a foreign key constraint for the inverse join column in a Many-to-Many relationship.
      Parameters:
      foreignKey - the name of the foreign key constraint
      foreignNameConstraints - the set containing the names of existing foreign key constraints
      joinTableName - the name of the join table
      relationEntityMetadata - the metadata of the related entity
      inverseJoinColumnName - the name of the inverse join column
      ddlMetadata - the metadata map for storing DDL queries