Class DDLQueryCreator
This class also provides methods for validating and creating DDL queries for various database operations.
The DDLQueryCreator class is designed to work in conjunction with other components of the Bibernate framework to facilitate database schema management and migration tasks.
- Since:
- 1.0
- Author:
- Blyzhnytsia Team
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionprivate final Map
<Class<?>, EntityMetadata> static final String
static final String
static final String
static final String
static final String
private final List
<FieldResolver> -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprivate void
checkIfColumnForIndexExists
(EntityMetadata entityMetadata, String columnList) Checks if the specified column exists in the entity metadata for creating an index.private void
createIndexQuery
(EntityMetadata entityMetadata) Creates Data Definition Language (DDL) queries for creating indexes on the specified entity table.void
Generates Data Definition Language (DDL) queries based on the metadata of Bibernate entities.
-
Field Details
-
DROP_TABLE
- See Also:
-
CREATE_INDEX
- See Also:
-
DELIMITER
- See Also:
-
CREATE_TABLE
- See Also:
-
BRACKET
- See Also:
-
dropSequences
-
createSequences
-
createTables
-
createIndexes
-
createConstraints
-
dropConstraints
-
dropTables
-
bibernateEntityMetadata
-
ddlMetadata
-
fieldResolvers
-
-
Constructor Details
-
DDLQueryCreator
public DDLQueryCreator()Constructs a new DDLQueryCreator instance.Initializes the DDL query metadata map and field resolvers list. Retrieves Bibernate entity metadata and sets up DDL metadata for various operations such as dropping constraints, tables and sequences, as well as creating sequences, tables, indexes and constraints. Finally, it invokes the createQueries() method to generate the DDL queries based on the entity metadata.
- See Also:
-
-
Method Details
-
createQueries
public void createQueries()Generates Data Definition Language (DDL) queries based on the metadata of Bibernate entities.Iterates over each Bibernate entity metadata and creates DDL queries for operations such as dropping tables, creating tables and creating indexes. For each entity, it creates DDL queries for its columns and resolves any associated field mappings using field resolvers.
The generated DDL queries are added to the respective lists in the DDL metadata map for further processing.
- Since:
- 1.0
- See Also:
-
createIndexQuery
Creates Data Definition Language (DDL) queries for creating indexes on the specified entity table.- Parameters:
entityMetadata
- the metadata of the entity for which indexes are created
-
checkIfColumnForIndexExists
Checks if the specified column exists in the entity metadata for creating an index.Verifies whether the specified column exists in the entity metadata list of columns. If the column does not exist, it throws a MappingException indicating that the column does not exist for creating an index.
- Parameters:
entityMetadata
- the metadata of the entitycolumnList
- the list of columns for which the index is being created- Throws:
MappingException
- if the specified column does not exist in the entity metadata
-