Author: dgeraskov
Date: 2011-12-22 05:03:04 -0500 (Thu, 22 Dec 2011)
New Revision: 37518
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate4_0/src/org/jboss/tools/hibernate4_0/console/ExporterFactory.java
Log:
https://issues.jboss.org/browse/JBIDE-10558
SchemaExport doesn't create file with script if both parameters exportToDatabase and
scriptToConsole are false.
Workaround added
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate4_0/src/org/jboss/tools/hibernate4_0/console/ExporterFactory.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate4_0/src/org/jboss/tools/hibernate4_0/console/ExporterFactory.java 2011-12-22
10:00:16 UTC (rev 37517)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate4_0/src/org/jboss/tools/hibernate4_0/console/ExporterFactory.java 2011-12-22
10:03:04 UTC (rev 37518)
@@ -290,7 +290,14 @@
if (getExporterDefinitionId().equals("org.hibernate.tools.hbm2ddl")) {
//$NON-NLS-1$
Hbm2DDLExporter ddlExporter = (Hbm2DDLExporter) exporter;
//avoid users to delete their databases with a single click
- ddlExporter.setExport(Boolean.parseBoolean(extract.getProperty(ExporterFactoryStrings.EXPORTTODATABASE)));
+ boolean exportToDatabse =
Boolean.parseBoolean(extract.getProperty(ExporterFactoryStrings.EXPORTTODATABASE));
+ ddlExporter.setExport(exportToDatabse);
+ if (!exportToDatabse && props.containsKey("outputFileName")){
+ //FIXME this is a workaround for
https://issues.jboss.org/browse/JBIDE-10558
+ //schema.ddl file is not generated
+ //if exportToDatabse=scriptToConsole=false
+ ddlExporter.getProperties().put("scriptToConsole", "true");
+ }
}
// special handling for QueryExporter
if (getExporterDefinitionId().equals("org.hibernate.tools.query")) {
//$NON-NLS-1$