net.sf.basedb.core.hibernate
Class SchemaGenerator
java.lang.Object
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) $
Constructor Summary |
SchemaGenerator(org.hibernate.cfg.Configuration cfg,
org.hibernate.dialect.Dialect dialect,
DbEngine dbEngine,
boolean update,
ProgressReporter progress)
Create a new schema generator. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
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
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 configurationdialect
- The dialect of the database we are connecting todbEngine
- The DbEngine for the database we are connecting toupdate
- TRUE if we are updating an existing database, FALSE if
we are creating a new oneprogress
- An optional progress reporter
execute
public void execute(Connection connection)
throws SQLException
- Specified by:
execute
in interface org.hibernate.jdbc.Work
- Throws:
SQLException