From: Kai Moritz Date: Sun, 6 Nov 2016 16:11:28 +0000 (+0100) Subject: Fixed error-reporting: errors reported by Hibernate are no longer swallowed X-Git-Tag: hibernate-maven-plugin-2.1.0~13 X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;h=b5f916e74bbfe359b1ca7e057a43e86fb081eca8;p=hibernate4-maven-plugin Fixed error-reporting: errors reported by Hibernate are no longer swallowed Renamed the H2-databases in the OSGI-tests of the Hibernate-Tutorials, because it showed, that these tests are failing, but only, if they are executed together through the parent-directory of the tutorial, but not, if they are executed separatly, which indicates timing issues in connection with the shutdown of the database. --- diff --git a/src/it/tutorials/osgi/datasource-h2.xml b/src/it/tutorials/osgi/datasource-h2.xml deleted file mode 100644 index 76ede3c8..00000000 --- a/src/it/tutorials/osgi/datasource-h2.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/src/it/tutorials/osgi/managed-jpa/pom.xml b/src/it/tutorials/osgi/managed-jpa/pom.xml index b1ac0d85..8c9fa47e 100644 --- a/src/it/tutorials/osgi/managed-jpa/pom.xml +++ b/src/it/tutorials/osgi/managed-jpa/pom.xml @@ -80,7 +80,7 @@ - jdbc:h2:mem:db1;MVCC=TRUE + jdbc:h2:mem:db_managed_jpa;MVCC=TRUE true false diff --git a/src/it/tutorials/osgi/unmanaged-jpa/src/main/resources/META-INF/persistence.xml b/src/it/tutorials/osgi/unmanaged-jpa/src/main/resources/META-INF/persistence.xml index 7c7efcae..0483f5c1 100644 --- a/src/it/tutorials/osgi/unmanaged-jpa/src/main/resources/META-INF/persistence.xml +++ b/src/it/tutorials/osgi/unmanaged-jpa/src/main/resources/META-INF/persistence.xml @@ -9,10 +9,10 @@ - + - \ No newline at end of file + diff --git a/src/it/tutorials/osgi/unmanaged-native/src/main/resources/hibernate.cfg.xml b/src/it/tutorials/osgi/unmanaged-native/src/main/resources/hibernate.cfg.xml index 278f529f..f367c530 100644 --- a/src/it/tutorials/osgi/unmanaged-native/src/main/resources/hibernate.cfg.xml +++ b/src/it/tutorials/osgi/unmanaged-native/src/main/resources/hibernate.cfg.xml @@ -6,7 +6,7 @@ org.h2.Driver - jdbc:h2:mem:db1;DB_CLOSE_DELAY=-1;MVCC=TRUE + jdbc:h2:mem:db_unmanaged_native;DB_CLOSE_DELAY=-1;MVCC=TRUE sa org.hibernate.dialect.H2Dialect diff --git a/src/it/tutorials/osgi/unmanaged-native/src/main/resources/pool-one.properties b/src/it/tutorials/osgi/unmanaged-native/src/main/resources/pool-one.properties index abaee385..0a372bd9 100644 --- a/src/it/tutorials/osgi/unmanaged-native/src/main/resources/pool-one.properties +++ b/src/it/tutorials/osgi/unmanaged-native/src/main/resources/pool-one.properties @@ -1,7 +1,7 @@ jdbc-0.proxool.alias=pool-one -jdbc-0.proxool.driver-url=jdbc:h2:mem:db1;DB_CLOSE_DELAY=-1;MVCC=TRUE +jdbc-0.proxool.driver-url=jdbc:h2:mem:db_unmanaged_native;DB_CLOSE_DELAY=-1;MVCC=TRUE jdbc-0.proxool.driver-class=org.h2.Driver jdbc-0.user=sa jdbc-0.password= jdbc-0.proxool.maximum-connection-count=2 -jdbc-0.proxool.house-keeping-test-sql=select CURRENT_DATE \ No newline at end of file +jdbc-0.proxool.house-keeping-test-sql=select CURRENT_DATE diff --git a/src/main/java/de/juplo/plugins/hibernate/AbstractSchemaMojo.java b/src/main/java/de/juplo/plugins/hibernate/AbstractSchemaMojo.java index 20c326aa..c9ef2c59 100644 --- a/src/main/java/de/juplo/plugins/hibernate/AbstractSchemaMojo.java +++ b/src/main/java/de/juplo/plugins/hibernate/AbstractSchemaMojo.java @@ -733,12 +733,23 @@ public abstract class AbstractSchemaMojo extends AbstractMojo { thread.setContextClassLoader(classLoader); build((MetadataImplementor)metadataBuilder.build(), options, target); + if (handler.getExceptions().size() > 0) + { + StringBuilder builder = new StringBuilder(); + builder.append("Hibernate failed:"); + for (Exception e : handler.getExceptions()) + { + builder.append("\n * "); + builder.append(e.getMessage()); + } + String error = builder.toString(); + getLog().error(error); + throw new MojoFailureException(error); + } } finally { thread.setContextClassLoader(contextClassLoader); - for (Exception e : handler.getExceptions()) - getLog().error(e.getMessage()); /** Track, the content of the generated script */ checkOutputFile(output, tracker); }