2.17.2: 2011-06-17

net.sf.basedb.core.hibernate
Class SchemaGenerator

java.lang.Object
  extended by net.sf.basedb.core.hibernate.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. 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: 2010-09-24 11:24:49 +0200 (Fri, 24 Sep 2010) $

Field Summary
private  org.hibernate.cfg.Configuration cfg
           
private  DbEngine dbEngine
           
private  org.hibernate.dialect.Dialect dialect
           
private static Logger log
           
private  ProgressReporter progress
           
private  boolean update
           
 
Constructor Summary
SchemaGenerator(org.hibernate.cfg.Configuration cfg, org.hibernate.dialect.Dialect dialect, DbEngine dbEngine, boolean update, ProgressReporter progress)
          Create a new schema generator.
 
Method Summary
 void execute(Connection connection)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

private static final Logger log

cfg

private final org.hibernate.cfg.Configuration cfg

dialect

private final org.hibernate.dialect.Dialect dialect

dbEngine

private final DbEngine dbEngine

update

private final boolean update

progress

private final ProgressReporter progress
Constructor Detail

SchemaGenerator

public SchemaGenerator(org.hibernate.cfg.Configuration cfg,
                       org.hibernate.dialect.Dialect dialect,
                       DbEngine dbEngine,
                       boolean update,
                       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
update - TRUE if we are updating an existing database, FALSE if we are creating a new one
progress - An optional progress reporter
Method Detail

execute

public void execute(Connection connection)
             throws SQLException
Specified by:
execute in interface org.hibernate.jdbc.Work
Throws:
SQLException

2.17.2: 2011-06-17