Author: dgeraskov
Date: 2010-06-07 09:27:25 -0400 (Mon, 07 Jun 2010)
New Revision: 22597
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/model/impl/ExporterFactory.java
Log:
https://jira.jboss.org/browse/JBIDE-6115
do not export generated script to database by default
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/model/impl/ExporterFactory.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/model/impl/ExporterFactory.java 2010-06-07
11:56:55 UTC (rev 22596)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/model/impl/ExporterFactory.java 2010-06-07
13:27:25 UTC (rev 22597)
@@ -23,6 +23,7 @@
import org.hibernate.tool.hbm2x.ArtifactCollector;
import org.hibernate.tool.hbm2x.Exporter;
import org.hibernate.tool.hbm2x.GenericExporter;
+import org.hibernate.tool.hbm2x.Hbm2DDLExporter;
import org.hibernate.util.StringHelper;
/**
@@ -175,7 +176,7 @@
Properties props = new Properties();
props.putAll(globalProperties);
props.putAll(getProperties());
-
+
exporter.setProperties(props);
exporter.setArtifactCollector(collector);
@@ -255,6 +256,13 @@
props.remove("for_each"); //$NON-NLS-1$
}
+ // special handling for Hbm2DDLExporter
+ if(getExporterDefinition().getId().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.getBoolean(props.getProperty("exportToDatabase",
Boolean.toString(false)))); //$NON-NLS-1$
+ props.remove("exportToDatabase"); //$NON-NLS-1$
+ }
return exporter;
}