Class SchemaGenerator

java.lang.Object
net.sf.basedb.core.hibernate.SchemaGenerator
All Implemented Interfaces:
Work

public class SchemaGenerator extends Object implements 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) $
  • Field Details

  • 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 configuration
      dialect - The dialect of the database we are connecting to
      dbEngine - The DbEngine for the database we are connecting to
      mode - The installation mode
      progress - An optional progress reporter
  • Method Details

    • execute

      public void execute(Connection connection) throws SQLException
      Specified by:
      execute in interface Work
      Throws:
      SQLException
    • getIgnoredSql

      public List<String> 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