From: Kai Moritz Date: Tue, 15 Jan 2013 08:09:05 +0000 (+0100) Subject: Bugfix: database-parameters for connection were not taken from properties X-Git-Tag: hibernate4-maven-plugin-1.0.1~7 X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;h=bcf07578452d7c31dc97410bc495c73bd0f87748;p=hibernate-maven-plugin Bugfix: database-parameters for connection were not taken from properties The hibernate-propertiesfile was read and used for the configuration of the SchemaExport-class, but the database-parameters from these source were ignored, when the database-connection was opened. --- diff --git a/src/main/java/de/juplo/plugins/hibernate4/Hbm2DdlMojo.java b/src/main/java/de/juplo/plugins/hibernate4/Hbm2DdlMojo.java index e7aa1541..7cae92f8 100644 --- a/src/main/java/de/juplo/plugins/hibernate4/Hbm2DdlMojo.java +++ b/src/main/java/de/juplo/plugins/hibernate4/Hbm2DdlMojo.java @@ -527,17 +527,28 @@ public class Hbm2DdlMojo extends AbstractMojo case CREATE: case DROP: case BOTH: - Class driverClass = classLoader.loadClass(driverClassName); + Class driverClass = classLoader.loadClass(properties.getProperty(DRIVER_CLASS)); getLog().debug("Registering JDBC-driver " + driverClass.getName()); DriverManager.registerDriver(new DriverProxy((Driver)driverClass.newInstance())); - getLog().debug("Opening JDBC-connection to " + url + " as " + username + " with password " + password); - connection = DriverManager.getConnection(url, username, password); + getLog().debug( + "Opening JDBC-connection to " + + properties.getProperty(URL) + + " as " + + properties.getProperty(USERNAME) + + " with password " + + properties.getProperty(PASSWORD) + ); + connection = DriverManager.getConnection( + properties.getProperty(URL), + properties.getProperty(USERNAME), + properties.getProperty(PASSWORD) + ); } } } catch (ClassNotFoundException e) { - getLog().error("Dependency for driver-class " + driverClassName + " is missing!"); + getLog().error("Dependency for driver-class " + properties.getProperty(DRIVER_CLASS) + " is missing!"); throw new MojoExecutionException(e.getMessage()); } catch (Exception e)