private String hibernateMapping;
/**
- * Do not output the script to stdout.
- *
- * @parameter property="hibernate.export.quiet" default-value="true"
- * @since 1.0.6
- */
- private boolean quiet;
-
- /**
- * Only drop the tables.
+ * Create drop-statements for the generated tables.
+ * At least one of {@link #drop} and {@link #create} must be set.
*
* @parameter property="hibernate.export.drop" default-value="true"
- * @since 1.0.6
+ * @since 2.0
*/
private boolean drop;
/**
- * Only create the tables.
+ * Create create-statements for the generated tables.
+ * At least one of {@link #drop} and {@link #create} must be set.
*
* @parameter property="hibernate.export.create" default-value="true"
- * @since 1.0.6
+ * @since 2.0
*/
private boolean create;
/**
- * Do not export to the database.
+ * Only create the database schema. Do not export it to the database.
*
- * @parameter property="hibernate.export.text" default-value="false"
- * @since 1.0.6
+ * @parameter property="hibernate.export.export" default-value="true"
+ * @since 2.0
*/
- private boolean text;
+ private boolean export;
/**
* Output file.
return;
}
+ if (!create && !drop)
+ throw new MojoFailureException(
+ "At least one of drop and create must be set!"
+ );
+
Map<String,String> md5s;
boolean modified = false;
File saved = new File(buildDirectory + File.separator + MD5S);
if (!modified)
{
getLog().info(
- "No modified annotated classes or mapping-files found and dialect " +
- "unchanged."
- );
- if (!force)
+ "No modified annotated classes or mapping-files found and " +
+ "dialect unchanged."
+ );
+ if (force)
+ getLog().info("Schema generation is forced!");
+ else
{
getLog().info("Skipping schema generation!");
project.getProperties().setProperty(EXPORT_SKIPPED_PROPERTY, "true");
* hibernate does not use the context-classloader of the current
* thread and, hence, would not be able to resolve the driver-class!
*/
- if (!text && (create || drop))
+ if (export)
{
Class driverClass = classLoader.loadClass(properties.getProperty(DRIVER_CLASS));
getLog().debug("Registering JDBC-driver " + driverClass.getName());
}
export.setOutputFile(outF.getPath());
- export.execute(!quiet, !text, drop, create);
+ export.execute(false, this.export, drop && !create, create && !drop);
for (Object exception : export.getExceptions())
getLog().debug(exception.toString());