Class ManyToManyFieldResolver
java.lang.Object
io.github.blyznytsiaorg.bibernate.ddl.field.ManyToManyFieldResolver
- All Implemented Interfaces:
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 Summary
Fields inherited from interface io.github.blyznytsiaorg.bibernate.ddl.field.FieldResolver
CREATE_CONSTRAINT, DROP_CONSTRAINT, NAME_DATA_PATTERN
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
handleField
(DDLFieldMetadataHolder metadataHolder, Map<Integer, List<String>> ddlMetadata) Handles the Many-to-Many field by creating the necessary DDL queries.boolean
hasFieldToResolve
(EntityColumnDetails entityColumnDetails) Determines whether the given entity column represents a Many-to-Many relationship.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.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.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.github.blyznytsiaorg.bibernate.ddl.field.FieldResolver
checkForeignKeyName
-
Field Details
-
CREATE_TABLE_MANY_TO_MANY
- See Also:
-
DROP_TABLE
- See Also:
-
-
Constructor Details
-
ManyToManyFieldResolver
public ManyToManyFieldResolver()
-
-
Method Details
-
hasFieldToResolve
Determines whether the given entity column represents a Many-to-Many relationship.- Specified by:
hasFieldToResolve
in interfaceFieldResolver
- 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 interfaceFieldResolver
- Parameters:
metadataHolder
- the holder containing metadata informationddlMetadata
- 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 constraintstableName
- the name of the table containing the join columnforeignKey
- the name of the foreign key constraintjoinTableName
- the name of the join tablejoinColumnName
- the name of the join columnddlMetadata
- 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 constraintforeignNameConstraints
- the set containing the names of existing foreign key constraintsjoinTableName
- the name of the join tablerelationEntityMetadata
- the metadata of the related entityinverseJoinColumnName
- the name of the inverse join columnddlMetadata
- the metadata map for storing DDL queries
-