Package io.jmix.dynmodel.impl.db
Class DbDynamicModelSchemaManager
java.lang.Object
io.jmix.dynmodel.impl.db.DbDynamicModelSchemaManager
- All Implemented Interfaces:
DynamicModelSchemaManager
@NullMarked
@Component("dynmod_DbDynamicModelSchemaManager")
public class DbDynamicModelSchemaManager
extends Object
implements DynamicModelSchemaManager
JDBC-based schema manager for dynamic model tables, columns, and unique constraints.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidalterColumn(MetaClass metaClass, MetaProperty property) Alters the physical column type/length of an existing dynamic attribute to match the given property.voidclear()Removes all database objects created by this manager.voidcreateSchema(MetaClass metaClass, Collection<MetaProperty> properties) Creates or updates the database schema for the given entity and its dynamic properties.voidcreateUniqueConstraints(MetaClass metaClass, Collection<DynamicUniqueConstraintDefinition> uniqueConstraints) Creates database unique constraints for the given entity.voiddropColumn(String tableName, String columnName) voiddropColumn(String storeName, String tableName, String columnName) voidvoidvoidremoveAttribute(MetaClass metaClass, MetaProperty property) protected voidremoveCollectionAttribute(MetaClass ownerMetaClass, MetaProperty property) voidremoveEntity(MetaClass metaClass) voidremoveUniqueConstraints(MetaClass metaClass, Collection<DynamicUniqueConstraintDefinition> uniqueConstraints) Removes database unique constraints for the given entity.voidvalidateUniqueConstraintsData(MetaClass metaClass, Collection<DynamicUniqueConstraintDefinition> uniqueConstraints) Verifies that existing table data satisfies the given unique constraints, throwing if duplicates exist.
-
Constructor Details
-
DbDynamicModelSchemaManager
public DbDynamicModelSchemaManager()
-
-
Method Details
-
createSchema
Description copied from interface:DynamicModelSchemaManagerCreates or updates the database schema for the given entity and its dynamic properties.- Specified by:
createSchemain interfaceDynamicModelSchemaManager- Parameters:
metaClass- the entity meta-classproperties- the dynamic properties to create columns for
-
createUniqueConstraints
public void createUniqueConstraints(MetaClass metaClass, Collection<DynamicUniqueConstraintDefinition> uniqueConstraints) Description copied from interface:DynamicModelSchemaManagerCreates database unique constraints for the given entity.- Specified by:
createUniqueConstraintsin interfaceDynamicModelSchemaManager- Parameters:
metaClass- owner metadata classuniqueConstraints- normalized unique constraints
-
validateUniqueConstraintsData
public void validateUniqueConstraintsData(MetaClass metaClass, Collection<DynamicUniqueConstraintDefinition> uniqueConstraints) Description copied from interface:DynamicModelSchemaManagerVerifies that existing table data satisfies the given unique constraints, throwing if duplicates exist. Used to fail before a destructive constraint replacement so the old constraint is preserved on failure.- Specified by:
validateUniqueConstraintsDatain interfaceDynamicModelSchemaManager- Parameters:
metaClass- owner metadata classuniqueConstraints- normalized unique constraints to validate against existing data
-
removeUniqueConstraints
public void removeUniqueConstraints(MetaClass metaClass, Collection<DynamicUniqueConstraintDefinition> uniqueConstraints) Description copied from interface:DynamicModelSchemaManagerRemoves database unique constraints for the given entity.- Specified by:
removeUniqueConstraintsin interfaceDynamicModelSchemaManager- Parameters:
metaClass- owner metadata classuniqueConstraints- normalized unique constraints
-
removeEntity
- Specified by:
removeEntityin interfaceDynamicModelSchemaManager
-
removeAttribute
- Specified by:
removeAttributein interfaceDynamicModelSchemaManager
-
alterColumn
Description copied from interface:DynamicModelSchemaManagerAlters the physical column type/length of an existing dynamic attribute to match the given property.- Specified by:
alterColumnin interfaceDynamicModelSchemaManager- Parameters:
metaClass- the owning entity meta-classproperty- the dynamic property whose column type changed
-
clear
public void clear()Description copied from interface:DynamicModelSchemaManagerRemoves all database objects created by this manager.- Specified by:
clearin interfaceDynamicModelSchemaManager
-
dropTable
-
dropTable
-
dropColumn
-
dropColumn
-
removeCollectionAttribute
-