3.1.2: 2012-07-31

net.sf.basedb.core.hibernate
Class SchemaGenerator

java.lang.Object
  extended by 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. In particular, since Hibernate 3.5 they 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: 2011-11-25 13:07:04 +0100 (Fri, 25 Nov 2011) $

Nested Class Summary
static class SchemaGenerator.Mode
          The installation mode.
 
Field Summary
private  Configuration cfg
           
private  DbEngine dbEngine
           
private  Dialect dialect
           
private  List<String> ignoredSql
           
private static org.apache.log4j.Logger log
           
private  SchemaGenerator.Mode mode
           
private  ProgressReporter progress
           
 
Constructor Summary
SchemaGenerator(Configuration cfg, Dialect dialect, DbEngine dbEngine, SchemaGenerator.Mode mode, ProgressReporter progress)
          Create a new schema generator.
 
Method Summary
 void execute(Connection connection)
           
 List<String> getIgnoredSql()
          Get a list with the SQL statements that was ignored in the last run.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

private static final org.apache.log4j.Logger log

cfg

private final Configuration cfg

dialect

private final Dialect dialect

dbEngine

private final DbEngine dbEngine

mode

private final SchemaGenerator.Mode mode

progress

private final ProgressReporter progress

ignoredSql

private List<String> ignoredSql
Constructor Detail

SchemaGenerator

public SchemaGenerator(Configuration cfg,
                       Dialect dialect,
                       DbEngine dbEngine,
                       SchemaGenerator.Mode mode,
                       ProgressReporter progress)
Create a new schema generator.

Parameters:
cfg - The 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

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

3.1.2: 2012-07-31