@@ -45,9 +45,10 @@ target(schemaExport: 'Run Hibernate SchemaExport') {
4545 def file = new File (filename)
4646 ant. mkdir dir : file. parentFile
4747
48- def configuration = appCtx. getBean(' &sessionFactory' + datasourceSuffix). configuration
48+ def sessionFactory = appCtx. getBean(' &sessionFactory' + datasourceSuffix)
49+ def configuration = sessionFactory. configuration
4950
50- def schemaExport = new HibernateSchemaExport (configuration)
51+ def schemaExport = new HibernateSchemaExport (configuration, sessionFactory . dataSource . connection )
5152 .setHaltOnError(true )
5253 .setOutputFile(file. path)
5354 .setDelimiter(' ;' )
@@ -56,17 +57,7 @@ target(schemaExport: 'Run Hibernate SchemaExport') {
5657 String ds = argsMap. datasource ? " for DataSource '$argsMap . datasource '" : " for the default DataSource"
5758 println " $action in environment '$grailsEnv ' $ds "
5859
59- if (export) {
60- // 1st drop, warning exceptions
61- schemaExport. execute stdout, true , true , false
62- schemaExport. exceptions. clear()
63- // then create
64- schemaExport. execute stdout, true , false , true
65- }
66- else {
67- // generate
68- schemaExport. execute stdout, false , false , false
69- }
60+ schemaExport. execute stdout, export, false , false
7061
7162 if (schemaExport. exceptions) {
7263 def e = schemaExport. exceptions[0 ]
0 commit comments