Package net.sf.basedb.core.hibernate
Class SchemaGenerator
java.lang.Object
net.sf.basedb.core.hibernate.SchemaGenerator
- All Implemented Interfaces:
Work
Replaces the Hibernate SchemaExport and SchemaUpdate tools. We need
this to be able to intercept and modify some of the SQL statments that
Hibernate generates since they don't always work as expected.
Since Hibernate 5 we only trust table and column definitions. Foreign keys
and indexes are created with
DbIndexWork
.
Hibernate generate "not null" constraints for
columns that are added to existing tables and we don't want that.- Since:
- 2.16
- Author:
- Nicklas
- Last modified
- $Date: 2023-03-31 09:53:31 +0200 (Fri, 31 Mar 2023) $
-
Nested Class Summary
Modifier and TypeClassDescription(package private) static class
Helper class used for collecting SQL statements generated by Hibernate schema creation/update tools.static enum
The installation mode.static class
-
Field Summary
Modifier and TypeFieldDescriptionprivate final DbEngine
private final Dialect
private static final Logger
private final Metadata
private final SchemaGenerator.Mode
private final ProgressReporter
-
Constructor Summary
ConstructorDescriptionSchemaGenerator
(Metadata metadata, Dialect dialect, DbEngine dbEngine, SchemaGenerator.Mode mode, ProgressReporter progress) Create a new schema generator. -
Method Summary
Modifier and TypeMethodDescriptionvoid
execute
(Connection connection) Get a list with the SQL statements that was ignored in the last run.
-
Field Details
-
log
-
metadata
-
dialect
-
dbEngine
-
mode
-
progress
-
ignoredSql
-
-
Constructor Details
-
SchemaGenerator
public SchemaGenerator(Metadata metadata, Dialect dialect, DbEngine dbEngine, SchemaGenerator.Mode mode, ProgressReporter progress) Create a new schema generator.- Parameters:
metadata
- Information about current configurationdialect
- The dialect of the database we are connecting todbEngine
- The DbEngine for the database we are connecting tomode
- The installation modeprogress
- An optional progress reporter
-
-
Method Details
-
execute
- Specified by:
execute
in interfaceWork
- Throws:
SQLException
-
getIgnoredSql
Get a list with the SQL statements that was ignored in the last run.- Returns:
- A list or null if the generator hasn't been executed
- Since:
- 3.1
-