Class NoRelationFieldResolver
java.lang.Object
io.github.blyznytsiaorg.bibernate.ddl.field.NoRelationFieldResolver
- All Implemented Interfaces:
FieldResolver
The NoRelationFieldResolver class implements the FieldResolver interface to handle fields that are not part of any relationship mapping.
- Since:
- 1.0
- Author:
- Blyzhnytsia Team
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionprivate static final int
private static final int
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
Fields inherited from interface io.github.blyznytsiaorg.bibernate.ddl.field.FieldResolver
CREATE_CONSTRAINT, DROP_CONSTRAINT
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprivate void
Checks if there is a duplicate sequence name in the DDL metadata and throws an exception if found.private void
generateSequence
(GeneratedValueMetadata generatedValue, SequenceGeneratorMetadata sequenceGenerator, String tableName, String columnName, Map<Integer, List<String>> ddlMetadata) Generates the sequence for the ID field if necessary and adds it to the DDL metadata.private String
getColumnNameDatabaseType
(EntityColumnDetails entityColumn) Gets the formatted string representing the column name and its database type.void
handleField
(DDLFieldMetadataHolder metadataHolder, Map<Integer, List<String>> ddlMetadata) Handles the resolution of the given entity column details by generating database type information and adding it to the list of column name and database type.boolean
hasFieldToResolve
(EntityColumnDetails entityColumnDetails) Checks if the given entity column details represent a field that needs resolution.private boolean
isCreationTimestamp
(EntityColumnDetails entityColumn) Checks if the timestamp column is marked for creation timestamp.private String
processIdField
(String tableName, EntityColumnDetails entityColumn, Map<Integer, List<String>> ddlMetadata) Processes the ID field by generating the database type information.private String
processTimestamp
(EntityColumnDetails entityColumn) Processes a timestamp column for database creation.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
-
PRIMARY_KEY_FIELD_CREATION
- See Also:
-
IDENTITY
- See Also:
-
SEQUENCE
- See Also:
-
DEFAULT_SEQ_TEMPLATE
- See Also:
-
SEQUENCE_CREATION
- See Also:
-
SEQUENCE_DROP
- See Also:
-
DEFAULT_INITIAL_VALUE
private static final int DEFAULT_INITIAL_VALUE- See Also:
-
DEFAULT_ALLOCATION_SIZE
private static final int DEFAULT_ALLOCATION_SIZE- See Also:
-
NAME_DATA_PATTERN_WITH_TIME_ZONE
- See Also:
-
TIMESTAMP_DEFAULT_NOW
- See Also:
-
TIMESTAMP_WITH_TIME_ZONE_DEFAULT_NOW
- See Also:
-
NAME_DATA_PATTERN
- See Also:
-
NOT_NULL
- See Also:
-
UNIQUE
- See Also:
-
-
Constructor Details
-
NoRelationFieldResolver
public NoRelationFieldResolver()
-
-
Method Details
-
hasFieldToResolve
Checks if the given entity column details represent a field that needs resolution. This method returns true if the entity column details do not correspond to any relationship mappings, such as @OneToOne, @ManyToOne, @OneToMany, or @ManyToMany.- Specified by:
hasFieldToResolve
in interfaceFieldResolver
- Parameters:
entityColumnDetails
- The entity column details to be checked.- Returns:
- True if the field needs resolution, false otherwise.
-
handleField
public void handleField(DDLFieldMetadataHolder metadataHolder, Map<Integer, List<String>> ddlMetadata) Handles the resolution of the given entity column details by generating database type information and adding it to the list of column name and database type.- Specified by:
handleField
in interfaceFieldResolver
- Parameters:
metadataHolder
- The holder containing metadata related to the field.ddlMetadata
- The map storing DDL metadata.
-
processIdField
private String processIdField(String tableName, EntityColumnDetails entityColumn, Map<Integer, List<String>> ddlMetadata) Processes the ID field by generating the database type information.- Parameters:
tableName
- The name of the table.entityColumn
- The entity column details.ddlMetadata
- The map storing DDL metadata.- Returns:
- The generated database type information for the ID field.
-
generateSequence
private void generateSequence(GeneratedValueMetadata generatedValue, SequenceGeneratorMetadata sequenceGenerator, String tableName, String columnName, Map<Integer, List<String>> ddlMetadata) Generates the sequence for the ID field if necessary and adds it to the DDL metadata.- Parameters:
generatedValue
- The metadata for the generated value.sequenceGenerator
- The metadata for the sequence generator.tableName
- The name of the table.columnName
- The name of the column.ddlMetadata
- The map storing DDL metadata.
-
checkForDuplicateNameSequence
private void checkForDuplicateNameSequence(Map<Integer, List<String>> ddlMetadata, String sequenceNameDefault) Checks if there is a duplicate sequence name in the DDL metadata and throws an exception if found.- Parameters:
ddlMetadata
- The map storing DDL metadata.sequenceNameDefault
- The name of the sequence to check for duplicates.- Throws:
MappingException
- if a duplicate sequence name is found.
-
processTimestamp
Processes a timestamp column for database creation.- Parameters:
entityColumn
- The details of the entity column.- Returns:
- The formatted string representing the timestamp column.
-
isCreationTimestamp
Checks if the timestamp column is marked for creation timestamp.- Parameters:
entityColumn
- The details of the entity column.- Returns:
- True if the column is marked for creation timestamp, false otherwise.
-
getColumnNameDatabaseType
Gets the formatted string representing the column name and its database type.- Parameters:
entityColumn
- The details of the entity column.- Returns:
- The formatted string representing the column name and its database type.
-