Class SchemaGenerator

  • All Implemented Interfaces:
    org.hibernate.jdbc.Work

    public class SchemaGenerator
    extends Object
    implements org.hibernate.jdbc.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: 2018-11-05 15:01:50 +0100 (må, 05 nov 2018) $
    • Field Detail

      • log

        private static final org.slf4j.Logger log
      • metadata

        private final org.hibernate.boot.Metadata metadata
      • dialect

        private final org.hibernate.dialect.Dialect dialect
      • dbEngine

        private final DbEngine dbEngine
    • Constructor Detail

      • SchemaGenerator

        public SchemaGenerator​(org.hibernate.boot.Metadata metadata,
                               org.hibernate.dialect.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 Detail

      • 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