<!-- Zeichensatz -->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<!-- Verwendete Versionen -->
- <hibernate.version>5.2.4.Final</hibernate.version>
+ <hibernate.version>5.2.18.Final</hibernate.version>
<hibernate-validator.version>5.3.1.Final</hibernate-validator.version>
<el-api.version>3.0.0</el-api.version>
<maven.version>3.3.3</maven.version>
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;
/** Loading and merging configuration from persistence-unit(s) */
ParsedPersistenceXmlDescriptor unit =
- loadPersistenceUnit(classLoaderService, properties);
+ loadPersistenceUnit(classLoader, properties);
if (unit != null)
properties.putAll(unit.getProperties());
}
private ParsedPersistenceXmlDescriptor loadPersistenceUnit(
- ClassLoaderService classLoaderService,
+ ClassLoader classLoader,
Properties properties
)
throws
MojoFailureException
{
- PersistenceXmlParser parser =
- new PersistenceXmlParser(
- classLoaderService,
- PersistenceUnitTransactionType.RESOURCE_LOCAL
- );
+ Map<String, ? extends Object> settings =
+ Collections.singletonMap(
+ AvailableSettings.CLASSLOADERS,
+ Collections.singletonList(classLoader)
+ );
+ // Find all available persistent unit descriptors
+ List<ParsedPersistenceXmlDescriptor> descriptors =
+ PersistenceXmlParser.locatePersistenceUnits(settings);
+ // Find all persistent units in the located descriptors
Map<String, ParsedPersistenceXmlDescriptor> units =
- parser.doResolve(properties);
+ new HashMap<String, ParsedPersistenceXmlDescriptor>();
+ 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)
{
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
+import java.util.regex.Pattern;
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!");