public class SchemaModifier extends Object
EntityModel
generates and executes DDL statements to create the corresponding
tables in a SQL database.Constructor and Description |
---|
SchemaModifier(Configuration configuration)
Create a new
SchemaModifier instance with a specific Mapping . |
SchemaModifier(DataSource dataSource,
EntityModel model)
Create a new
SchemaModifier instance with the default Mapping . |
Modifier and Type | Method and Description |
---|---|
<T> void |
addColumn(Attribute<T,?> attribute)
Alters the attribute's table and add's the column representing the given
Attribute . |
void |
createTables(TableCreationMode mode)
Create the tables over the connection.
|
String |
createTablesString(TableCreationMode mode)
Convenience method to generated the create table statements as a string.
|
<T> void |
dropColumn(Attribute<T,?> attribute)
Alters the attribute's table and removes the column representing the given
Attribute . |
void |
dropTables()
Drop all tables in the schema.
|
<T> String |
tableCreateStatement(Type<T> type,
TableCreationMode mode) |
public SchemaModifier(DataSource dataSource, EntityModel model)
SchemaModifier
instance with the default Mapping
.dataSource
- DataSource
to usemodel
- entity modelpublic SchemaModifier(Configuration configuration)
SchemaModifier
instance with a specific Mapping
.configuration
- data configurationpublic void createTables(TableCreationMode mode)
mode
- creation mode.TableModificationException
- if the creation fails.public String createTablesString(TableCreationMode mode)
mode
- table creation modepublic void dropTables()
public <T> void addColumn(Attribute<T,?> attribute)
Attribute
.T
- parent type of the attributeattribute
- being addedpublic <T> void dropColumn(Attribute<T,?> attribute)
Attribute
.T
- parent type of the attributeattribute
- being addedpublic <T> String tableCreateStatement(Type<T> type, TableCreationMode mode)