public class SchemaGenerator
extends java.lang.Object
Note that unfortunately there does not appear to be a way to specify the order of the columns in the resulting create table SQL statements. Though this has been asked for, it appears to still be a limitation of Hibernate. The default ordering appears to be first the @Id columns in reverse alphabetical order, and then the non @Id columns in alphabetical order. Yes, quite peculiar.
Since the resulting automatically generated files have unneeded drop commands these are filtered out. This way the resulting sql is smaller and easier to understand.
Modifier and Type | Class and Description |
---|---|
static class |
SchemaGenerator.ImprovedMySQLDialect
MySQL handles fractional seconds differently from PostGRES and other
DBs.
|
Constructor and Description |
---|
SchemaGenerator(java.lang.String packageName,
java.lang.String outputDirectory) |
Modifier and Type | Method and Description |
---|---|
static void |
main(java.lang.String[] args)
Param args args[0] is the package name for the Hibernate annotated
classes whose schema is to be exported such as
"org.transitime.db.structs".
|
public SchemaGenerator(java.lang.String packageName, java.lang.String outputDirectory) throws java.lang.Exception
java.lang.Exception
public static void main(java.lang.String[] args) throws java.lang.Exception
The resulting files have the name "ddl_" plus dialect name such as mysql or oracle plus the first two components of the package name such as org_transitime.
java.lang.Exception