From: Kai Moritz Date: Fri, 5 Apr 2019 08:42:41 +0000 (+0200) Subject: Upgraded Hibernate from 5.2.4.Final to 5.2.18.Final X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;h=ebc47344a380e8826aeaec7f6e4717e7013212d4;p=hibernate4-maven-plugin Upgraded Hibernate from 5.2.4.Final to 5.2.18.Final --- diff --git a/pom.xml b/pom.xml index a476f7e5..f4789fad 100644 --- a/pom.xml +++ b/pom.xml @@ -129,7 +129,7 @@ UTF-8 - 5.2.4.Final + 5.2.18.Final 3.0.1-b06 3.6.0 1.0.1 diff --git a/src/it/update/update.sql b/src/it/update/update.sql index 0c9457ca..d739136f 100644 --- a/src/it/update/update.sql +++ b/src/it/update/update.sql @@ -1,3 +1,3 @@ - alter table EVENTS - add column MY_NEW_EVENT_DATE_COLUMN timestamp; + alter table TEST.PUBLIC.EVENTS + add column MY_NEW_EVENT_DATE_COLUMN timestamp; diff --git a/src/main/java/de/juplo/plugins/hibernate/AbstractSchemaMojo.java b/src/main/java/de/juplo/plugins/hibernate/AbstractSchemaMojo.java index 41c55ded..72ec9d4d 100644 --- a/src/main/java/de/juplo/plugins/hibernate/AbstractSchemaMojo.java +++ b/src/main/java/de/juplo/plugins/hibernate/AbstractSchemaMojo.java @@ -27,7 +27,6 @@ import java.util.regex.Pattern; import javax.persistence.Embeddable; import javax.persistence.Entity; import javax.persistence.MappedSuperclass; -import javax.persistence.spi.PersistenceUnitTransactionType; import org.apache.maven.artifact.Artifact; import org.apache.maven.model.Resource; import org.apache.maven.plugin.AbstractMojo; @@ -496,7 +495,7 @@ public abstract class AbstractSchemaMojo extends AbstractMojo /** Loading and merging configuration from persistence-unit(s) */ ParsedPersistenceXmlDescriptor unit = - loadPersistenceUnit(classLoaderService, properties); + loadPersistenceUnit(classLoader, properties); if (unit != null) properties.putAll(unit.getProperties()); @@ -1381,20 +1380,36 @@ public abstract class AbstractSchemaMojo extends AbstractMojo } private ParsedPersistenceXmlDescriptor loadPersistenceUnit( - ClassLoaderService classLoaderService, + ClassLoader classLoader, Properties properties ) throws MojoFailureException { - PersistenceXmlParser parser = - new PersistenceXmlParser( - classLoaderService, - PersistenceUnitTransactionType.RESOURCE_LOCAL - ); + Map settings = + Collections.singletonMap( + AvailableSettings.CLASSLOADERS, + Collections.singletonList(classLoader) + ); + // Find all available persistent unit descriptors + List descriptors = + PersistenceXmlParser.locatePersistenceUnits(settings); + // Find all persistent units in the located descriptors Map units = - parser.doResolve(properties); + new HashMap(); + for (ParsedPersistenceXmlDescriptor descriptor : descriptors) + { + String unit = descriptor.getName(); + if (units.containsKey(unit)) + getLog().warn( + "Persistence unit " + unit + + " from " + descriptor.getPersistenceUnitRootUrl() + + " overwrites unit with the same name from " + + units.get(unit).getPersistenceUnitRootUrl() + ); + units.put(unit, descriptor); + } if (persistenceUnit == null) { diff --git a/src/test/java/de/juplo/test/FileComparator.java b/src/test/java/de/juplo/test/FileComparator.java index beb25641..9229fc89 100644 --- a/src/test/java/de/juplo/test/FileComparator.java +++ b/src/test/java/de/juplo/test/FileComparator.java @@ -5,6 +5,7 @@ import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; +import java.util.regex.Pattern; public class FileComparator @@ -36,6 +37,15 @@ public class FileComparator while ((expected = expectedReader.readLine()) != null) { found = foundReader.readLine(); + if (found == null) + { + System.err.println("Found less content than expected!"); + System.err.println("First missing line: " + expected); + return false; + } + + expected = expected.trim(); + found = found.trim(); if (!expected.equals(found)) { System.err.println("Mismatch!");