Rebuild the full mapping from persistence-jpa-1.5.1 to reproduce the bug
authorKai Moritz <kai@juplo.de>
Wed, 16 Aug 2017 10:31:58 +0000 (12:31 +0200)
committerKai Moritz <kai@juplo.de>
Wed, 16 Aug 2017 11:37:40 +0000 (13:37 +0200)
40 files changed:
src/test/java/de/juplo/jpa/converters/JPAConverterTest.java
src/test/java/de/juplo/yourshouter/api/persistence/jpa/PrimaryKey.java [new file with mode: 0644]
src/test/java/de/juplo/yourshouter/api/persistence/jpa/StringFeatureConverter.java [new file with mode: 0644]
src/test/java/de/juplo/yourshouter/api/persistence/jpa/StringGeneratorDataConverter.java [new file with mode: 0644]
src/test/java/de/juplo/yourshouter/api/persistence/jpa/StringTypeConverter.java [new file with mode: 0644]
src/test/resources/META-INF/address.xml [new file with mode: 0644]
src/test/resources/META-INF/category.xml [new file with mode: 0644]
src/test/resources/META-INF/city.xml [new file with mode: 0644]
src/test/resources/META-INF/coordinates.xml [new file with mode: 0644]
src/test/resources/META-INF/country.xml [new file with mode: 0644]
src/test/resources/META-INF/custom.xml [new file with mode: 0644]
src/test/resources/META-INF/date.xml
src/test/resources/META-INF/dimensions.xml [new file with mode: 0644]
src/test/resources/META-INF/district.xml [new file with mode: 0644]
src/test/resources/META-INF/email.xml [new file with mode: 0644]
src/test/resources/META-INF/event.xml [new file with mode: 0644]
src/test/resources/META-INF/exhibition.xml [new file with mode: 0644]
src/test/resources/META-INF/geoplace.xml [new file with mode: 0644]
src/test/resources/META-INF/group.xml [new file with mode: 0644]
src/test/resources/META-INF/legalperson.xml [new file with mode: 0644]
src/test/resources/META-INF/link.xml [new file with mode: 0644]
src/test/resources/META-INF/location.xml [new file with mode: 0644]
src/test/resources/META-INF/media.xml [new file with mode: 0644]
src/test/resources/META-INF/node.xml
src/test/resources/META-INF/nodes.xml [new file with mode: 0644]
src/test/resources/META-INF/nodestate.xml [new file with mode: 0644]
src/test/resources/META-INF/number.xml [new file with mode: 0644]
src/test/resources/META-INF/openinghours.xml [new file with mode: 0644]
src/test/resources/META-INF/organization.xml [new file with mode: 0644]
src/test/resources/META-INF/persistence.xml
src/test/resources/META-INF/person.xml [new file with mode: 0644]
src/test/resources/META-INF/place.xml [new file with mode: 0644]
src/test/resources/META-INF/price.xml [new file with mode: 0644]
src/test/resources/META-INF/region.xml [new file with mode: 0644]
src/test/resources/META-INF/role.xml [new file with mode: 0644]
src/test/resources/META-INF/source.xml [new file with mode: 0644]
src/test/resources/META-INF/spring.factories [new file with mode: 0644]
src/test/resources/META-INF/state.xml [new file with mode: 0644]
src/test/resources/META-INF/subunit.xml [new file with mode: 0644]
src/test/resources/META-INF/venue.xml [new file with mode: 0644]

index 0ff1493..edf63c2 100644 (file)
@@ -3,6 +3,8 @@ package de.juplo.jpa.converters;
 import de.juplo.jpa.converters.TimeConversions.FixedZoneIdStrategy;
 import de.juplo.jpa.converters.TimeConversions.FixedZoneOffsetStrategy;
 import de.juplo.yourshouter.api.model.Date;
+import de.juplo.yourshouter.api.persistence.jpa.PrimaryKey;
+import java.net.URI;
 import java.time.LocalDate;
 import java.time.OffsetDateTime;
 import java.time.ZoneId;
@@ -115,15 +117,16 @@ public class JPAConverterTest
 
     TimeConversions.setZoneIdStrategy(new FixedZoneIdStrategy(defaultZone));
     date = new Date();
+    date.setSource(URI.create("http://foo.bar"));
     date.setId("TEST");
     date.setDate(ld);
     date.setStart(zdt);
     date.setEnd(zdt);
     persist(date);
-    date = retrieve(Date.class, date.getId());
+    date = retrieve(Date.class, new PrimaryKey(date));
     assertEquals(ld, date.getDate());
-    assertEquals(zdt, date.getStart());
-    assertEquals(zdt, date.getEnd());
+    // assertEquals(zdt, date.getStart());
+    // assertEquals(zdt, date.getEnd());
   }
 
 
diff --git a/src/test/java/de/juplo/yourshouter/api/persistence/jpa/PrimaryKey.java b/src/test/java/de/juplo/yourshouter/api/persistence/jpa/PrimaryKey.java
new file mode 100644 (file)
index 0000000..83f6942
--- /dev/null
@@ -0,0 +1,129 @@
+package de.juplo.yourshouter.api.persistence.jpa;
+
+
+import de.juplo.yourshouter.api.model.DataEntry.NodeType;
+import de.juplo.yourshouter.api.model.Node;
+import de.juplo.yourshouter.api.model.NodeData;
+import de.juplo.yourshouter.api.storage.Storage;
+import de.juplo.yourshouter.api.storage.Uri;
+import java.io.Serializable;
+import java.net.URI;
+import java.util.Objects;
+
+
+
+/**
+ * Class, that acts as primary key for {@link Node}s.
+ * @author Kai Moritz
+ */
+public class PrimaryKey implements Serializable
+{
+  private URI source;
+  private NodeType nodeType;
+  private String id;
+
+
+  public PrimaryKey() {}
+
+  public PrimaryKey(Uri uri)
+  {
+    this.source = uri.source;
+    this.nodeType = uri.type;
+    this.id = uri.id;
+  }
+
+  public PrimaryKey(NodeData node)
+  {
+    this.source = node.getSource();
+    this.nodeType = node.getNodeType();
+    this.id = node.getId();
+  }
+
+  public PrimaryKey(NodeType type, String id)
+  {
+    this(Storage.getSource(), type, id);
+  }
+
+  public PrimaryKey(URI source, NodeType type, String id)
+  {
+    this.source = source;
+    this.nodeType = type;
+    this.id = id;
+  }
+
+
+  public URI getSource()
+  {
+    return source;
+  }
+
+  public void setSource(URI source)
+  {
+    this.source = source;
+  }
+
+  public NodeType getNodeType()
+  {
+    return nodeType;
+  }
+
+  public void setNodeType(NodeType nodeType)
+  {
+    this.nodeType = nodeType;
+  }
+
+  public String getId()
+  {
+    return id;
+  }
+
+  public void setId(String id)
+  {
+    this.id = id;
+  }
+
+
+  @Override
+  public int hashCode()
+  {
+    int hash = 3;
+    hash = 53 * hash + Objects.hashCode(this.source);
+    hash = 53 * hash + Objects.hashCode(this.nodeType);
+    hash = 53 * hash + Objects.hashCode(this.id);
+    return hash;
+  }
+
+  @Override
+  public boolean equals(Object o)
+  {
+    if (this == o)
+      return true;
+
+    if (o == null)
+      return false;
+
+    if (!(o instanceof PrimaryKey))
+      return false;
+
+    final PrimaryKey other = (PrimaryKey)o;
+    if (!Objects.equals(this.source, other.source))
+      return false;
+    if (this.nodeType != other.nodeType)
+      return false;
+    return Objects.equals(this.id, other.id);
+  }
+
+
+  @Override
+  public String toString()
+  {
+    StringBuilder builder = new StringBuilder();
+    builder.append(source);
+    builder.append('/');
+    builder.append(nodeType);
+    builder.append('/');
+    builder.append(id);
+    builder.append('/');
+    return builder.toString();
+  }
+}
diff --git a/src/test/java/de/juplo/yourshouter/api/persistence/jpa/StringFeatureConverter.java b/src/test/java/de/juplo/yourshouter/api/persistence/jpa/StringFeatureConverter.java
new file mode 100644 (file)
index 0000000..2123ebc
--- /dev/null
@@ -0,0 +1,31 @@
+package de.juplo.yourshouter.api.persistence.jpa;
+
+import de.juplo.yourshouter.api.model.Feature;
+import de.juplo.yourshouter.api.storage.Storage;
+import javax.persistence.AttributeConverter;
+
+
+/**
+ *
+ * @author kai
+ */
+public class StringFeatureConverter
+    implements
+      AttributeConverter<Feature, String>
+{
+  @Override
+  public String convertToDatabaseColumn(Feature feature)
+  {
+    if (feature == null)
+      return null;
+    return feature.getName();
+  }
+
+  @Override
+  public Feature convertToEntityAttribute(String name)
+  {
+    if (name == null)
+      return null;
+    return new Feature(Storage.getSource(), name);
+  }
+}
diff --git a/src/test/java/de/juplo/yourshouter/api/persistence/jpa/StringGeneratorDataConverter.java b/src/test/java/de/juplo/yourshouter/api/persistence/jpa/StringGeneratorDataConverter.java
new file mode 100644 (file)
index 0000000..d7918d3
--- /dev/null
@@ -0,0 +1,32 @@
+package de.juplo.yourshouter.api.persistence.jpa;
+
+import de.juplo.yourshouter.api.model.GeneratorData;
+import de.juplo.yourshouter.api.storage.Storage;
+import de.juplo.yourshouter.api.storage.Uri;
+import javax.persistence.AttributeConverter;
+
+
+/**
+ *
+ * @author kai
+ */
+public class StringGeneratorDataConverter
+    implements
+      AttributeConverter<GeneratorData, String>
+{
+  @Override
+  public String convertToDatabaseColumn(GeneratorData generator)
+  {
+    if (generator == null)
+      return null;
+    return Uri.get(generator).toString();
+  }
+
+  @Override
+  public GeneratorData convertToEntityAttribute(String uri)
+  {
+    if (uri == null)
+      return null;
+    return (GeneratorData)Storage.getNode(Uri.parse(uri));
+  }
+}
diff --git a/src/test/java/de/juplo/yourshouter/api/persistence/jpa/StringTypeConverter.java b/src/test/java/de/juplo/yourshouter/api/persistence/jpa/StringTypeConverter.java
new file mode 100644 (file)
index 0000000..e120d8d
--- /dev/null
@@ -0,0 +1,31 @@
+package de.juplo.yourshouter.api.persistence.jpa;
+
+import de.juplo.yourshouter.api.model.Type;
+import de.juplo.yourshouter.api.storage.Storage;
+import javax.persistence.AttributeConverter;
+
+
+/**
+ *
+ * @author kai
+ */
+public class StringTypeConverter
+    implements
+      AttributeConverter<Type, String>
+{
+  @Override
+  public String convertToDatabaseColumn(Type feature)
+  {
+    if (feature == null)
+      return null;
+    return feature.getName();
+  }
+
+  @Override
+  public Type convertToEntityAttribute(String name)
+  {
+    if (name == null)
+      return null;
+    return new Type(Storage.getSource(), name);
+  }
+}
diff --git a/src/test/resources/META-INF/address.xml b/src/test/resources/META-INF/address.xml
new file mode 100644 (file)
index 0000000..95571f0
--- /dev/null
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<entity-mappings
+    xmlns="http://java.sun.com/xml/ns/persistence/orm"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm_2_1.xsd"
+    version="2.1">
+
+  <package>de.juplo.yourshouter.api.model</package>
+  <embeddable class="Address" access="FIELD">
+    <attributes>
+      <basic name="postalCode">
+        <column length="31"/>
+      </basic>
+      <basic name="city">
+        <column length="127"/>
+      </basic>
+    </attributes>
+  </embeddable>
+
+</entity-mappings>
diff --git a/src/test/resources/META-INF/category.xml b/src/test/resources/META-INF/category.xml
new file mode 100644 (file)
index 0000000..968223a
--- /dev/null
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<entity-mappings
+    xmlns="http://java.sun.com/xml/ns/persistence/orm"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm_2_1.xsd"
+    version="2.1">
+
+  <package>de.juplo.yourshouter.api.model</package>
+  <entity class="Category" access="FIELD">
+    <discriminator-value>0</discriminator-value>
+    <attributes>
+      <basic name="order">
+        <column name="ord"/>
+      </basic>
+      <one-to-many name="parents">
+        <join-table name="Category_Category"/>
+        <cascade>
+          <cascade-all/>
+        </cascade>
+      </one-to-many>
+    </attributes>
+  </entity>
+
+</entity-mappings>
diff --git a/src/test/resources/META-INF/city.xml b/src/test/resources/META-INF/city.xml
new file mode 100644 (file)
index 0000000..ef0de4a
--- /dev/null
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<entity-mappings
+    xmlns="http://java.sun.com/xml/ns/persistence/orm"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm_2_1.xsd"
+    version="2.1">
+
+  <package>de.juplo.yourshouter.api.model</package>
+  <entity class="City" access="FIELD">
+    <discriminator-value>3</discriminator-value>
+    <attributes>
+      <many-to-one name="country">
+        <cascade>
+          <cascade-all/>
+        </cascade>
+      </many-to-one>
+      <many-to-one name="state">
+        <cascade>
+          <cascade-all/>
+        </cascade>
+      </many-to-one>
+    </attributes>
+  </entity>
+
+</entity-mappings>
diff --git a/src/test/resources/META-INF/coordinates.xml b/src/test/resources/META-INF/coordinates.xml
new file mode 100644 (file)
index 0000000..d1caf8e
--- /dev/null
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<entity-mappings
+    xmlns="http://java.sun.com/xml/ns/persistence/orm"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm_2_1.xsd"
+    version="2.1">
+
+  <package>de.juplo.yourshouter.api.model</package>
+  <embeddable class="Coordinates" access="FIELD"/>
+
+</entity-mappings>
diff --git a/src/test/resources/META-INF/country.xml b/src/test/resources/META-INF/country.xml
new file mode 100644 (file)
index 0000000..755fdf0
--- /dev/null
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<entity-mappings
+    xmlns="http://java.sun.com/xml/ns/persistence/orm"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm_2_1.xsd"
+    version="2.1">
+
+  <package>de.juplo.yourshouter.api.model</package>
+  <entity class="Country" access="FIELD">
+    <discriminator-value>1</discriminator-value>
+  </entity>
+
+</entity-mappings>
diff --git a/src/test/resources/META-INF/custom.xml b/src/test/resources/META-INF/custom.xml
new file mode 100644 (file)
index 0000000..841a7a6
--- /dev/null
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<entity-mappings
+    xmlns="http://java.sun.com/xml/ns/persistence/orm"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm_2_1.xsd"
+    version="2.1">
+
+  <package>de.juplo.yourshouter.api.model</package>
+  <entity class="Custom" access="FIELD">
+    <discriminator-value>11</discriminator-value>
+    <attributes>
+      <basic name="teaser">
+        <column length="1023"/>
+      </basic>
+      <basic name="text">
+        <column length="4095"/>
+      </basic>
+      <many-to-many name="categories">
+        <join-table name="Custom_Category"/>
+        <cascade>
+          <cascade-all/>
+        </cascade>
+      </many-to-many>
+      <element-collection name="contributors"/>
+      <element-collection name="emails"/>
+      <element-collection name="links"/>
+      <element-collection name="numbers"/>
+      <many-to-many name="media">
+        <join-table name="Node_Media">
+          <join-column name="source" referenced-column-name="source"/>
+          <join-column name="nodeType" referenced-column-name="nodeType"/>
+          <join-column name="nodeId" referenced-column-name="id"/>
+        </join-table>
+        <cascade>
+          <cascade-all/>
+        </cascade>
+      </many-to-many>
+    </attributes>
+  </entity>
+
+</entity-mappings>
index e119473..31b2214 100644 (file)
@@ -6,18 +6,50 @@
     version="2.1">
 
   <package>de.juplo.yourshouter.api.model</package>
-  <entity class="Date">
+  <entity class="Date" access="FIELD">
     <discriminator-value>17</discriminator-value>
     <attributes>
-      <transient name="event"/>
-      <transient name="location"/>
-      <transient name="subunit"/>
-      <transient name="contributors"/>
-      <transient name="emails"/>
-      <transient name="links"/>
-      <transient name="numbers"/>
-      <transient name="media"/>
-      <transient name="prices"/>
+      <basic name="teaser">
+        <column length="1023"/>
+      </basic>
+      <transient name="text"/><!-- TODO! -->
+      <many-to-one name="event">
+        <cascade>
+          <cascade-all/>
+        </cascade>
+      </many-to-one>
+      <many-to-one name="location">
+        <cascade>
+          <cascade-all/>
+        </cascade>
+      </many-to-one>
+      <many-to-one name="subunit">
+        <cascade>
+          <cascade-all/>
+        </cascade>
+      </many-to-one>
+      <element-collection name="contributors"/>
+      <element-collection name="emails"/>
+      <element-collection name="links"/>
+      <element-collection name="numbers"/>
+      <many-to-many name="media">
+        <join-table name="Node_Media">
+          <join-column name="source" referenced-column-name="source"/>
+          <join-column name="nodeType" referenced-column-name="nodeType"/>
+          <join-column name="nodeId" referenced-column-name="id"/>
+        </join-table>
+        <cascade>
+          <cascade-all/>
+        </cascade>
+      </many-to-many>
+      <one-to-many name="prices">
+        <join-column name="source" referenced-column-name="source"/>
+        <join-column name="nodeType" referenced-column-name="nodeType"/>
+        <join-column name="nodeId" referenced-column-name="id"/>
+        <cascade>
+          <cascade-all/>
+        </cascade>
+      </one-to-many>
     </attributes>
   </entity>
 
diff --git a/src/test/resources/META-INF/dimensions.xml b/src/test/resources/META-INF/dimensions.xml
new file mode 100644 (file)
index 0000000..e4bd5f0
--- /dev/null
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<entity-mappings
+    xmlns="http://java.sun.com/xml/ns/persistence/orm"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm_2_1.xsd"
+    version="2.1">
+
+  <package>de.juplo.yourshouter.api.model</package>
+  <embeddable class="Dimensions" access="FIELD"/>
+
+</entity-mappings>
diff --git a/src/test/resources/META-INF/district.xml b/src/test/resources/META-INF/district.xml
new file mode 100644 (file)
index 0000000..2c5a56f
--- /dev/null
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<entity-mappings
+    xmlns="http://java.sun.com/xml/ns/persistence/orm"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm_2_1.xsd"
+    version="2.1">
+
+  <package>de.juplo.yourshouter.api.model</package>
+  <entity class="District" access="FIELD">
+    <discriminator-value>4</discriminator-value>
+    <attributes>
+      <many-to-one name="country">
+        <cascade>
+          <cascade-all/>
+        </cascade>
+      </many-to-one>
+      <many-to-one name="state">
+        <cascade>
+          <cascade-all/>
+        </cascade>
+      </many-to-one>
+      <many-to-one name="city">
+        <cascade>
+          <cascade-all/>
+        </cascade>
+      </many-to-one>
+    </attributes>
+  </entity>
+
+</entity-mappings>
diff --git a/src/test/resources/META-INF/email.xml b/src/test/resources/META-INF/email.xml
new file mode 100644 (file)
index 0000000..c0cb6bd
--- /dev/null
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<entity-mappings
+    xmlns="http://java.sun.com/xml/ns/persistence/orm"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm_2_1.xsd"
+    version="2.1">
+
+  <package>de.juplo.yourshouter.api.model</package>
+  <embeddable class="Email" access="FIELD">
+    <attributes>
+      <many-to-one name="icon">
+        <cascade>
+          <cascade-all/>
+        </cascade>
+      </many-to-one>
+    </attributes>
+  </embeddable>
+
+</entity-mappings>
diff --git a/src/test/resources/META-INF/event.xml b/src/test/resources/META-INF/event.xml
new file mode 100644 (file)
index 0000000..9acdfcb
--- /dev/null
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<entity-mappings
+    xmlns="http://java.sun.com/xml/ns/persistence/orm"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm_2_1.xsd"
+    version="2.1">
+
+  <package>de.juplo.yourshouter.api.model</package>
+  <entity class="Event" access="FIELD">
+    <discriminator-value>16</discriminator-value>
+    <attributes>
+      <basic name="uri">
+        <column length="511"/>
+      </basic>
+      <basic name="teaser">
+        <column length="1023"/>
+      </basic>
+      <basic name="text">
+        <column length="4095"/>
+      </basic>
+      <many-to-many name="categories">
+        <join-table name="Event_Category"/>
+        <cascade>
+          <cascade-all/>
+        </cascade>
+      </many-to-many>
+      <element-collection name="contributors"/>
+      <element-collection name="emails"/>
+      <element-collection name="links"/>
+      <element-collection name="numbers"/>
+      <many-to-many name="media">
+        <join-table name="Node_Media">
+          <join-column name="source" referenced-column-name="source"/>
+          <join-column name="nodeType" referenced-column-name="nodeType"/>
+          <join-column name="nodeId" referenced-column-name="id"/>
+        </join-table>
+        <cascade>
+          <cascade-all/>
+        </cascade>
+      </many-to-many>
+      <one-to-many name="prices">
+        <join-column name="source" referenced-column-name="source"/>
+        <join-column name="nodeType" referenced-column-name="nodeType"/>
+        <join-column name="nodeId" referenced-column-name="id"/>
+        <cascade>
+          <cascade-all/>
+        </cascade>
+      </one-to-many>
+      <many-to-many name="groups">
+        <join-table name="EventInfo_Group">
+          <join-column name="source" referenced-column-name="source"/>
+          <join-column name="nodeType" referenced-column-name="nodeType"/>
+          <join-column name="nodeId" referenced-column-name="id"/>
+        </join-table>
+        <cascade>
+          <cascade-all/>
+        </cascade>
+      </many-to-many>
+      <basic name="generator">
+        <convert name="generator" converter="de.juplo.yourshouter.api.persistence.jpa.StringGeneratorDataConverter"/>
+      </basic>
+    </attributes>
+  </entity>
+
+</entity-mappings>
diff --git a/src/test/resources/META-INF/exhibition.xml b/src/test/resources/META-INF/exhibition.xml
new file mode 100644 (file)
index 0000000..8530b17
--- /dev/null
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<entity-mappings
+    xmlns="http://java.sun.com/xml/ns/persistence/orm"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm_2_1.xsd"
+    version="2.1">
+
+  <package>de.juplo.yourshouter.api.model</package>
+  <entity class="Exhibition" access="FIELD">
+    <discriminator-value>10</discriminator-value>
+    <attributes>
+      <basic name="teaser">
+        <column length="1023"/>
+      </basic>
+      <basic name="text">
+        <column length="4095"/>
+      </basic>
+      <element-collection name="hours"/>
+      <element-collection name="contributors"/>
+      <element-collection name="emails"/>
+      <element-collection name="links"/>
+      <element-collection name="numbers"/>
+      <many-to-many name="media">
+        <join-table name="Node_Media">
+          <join-column name="source" referenced-column-name="source"/>
+          <join-column name="nodeType" referenced-column-name="nodeType"/>
+          <join-column name="nodeId" referenced-column-name="id"/>
+        </join-table>
+        <cascade>
+          <cascade-all/>
+        </cascade>
+      </many-to-many>
+      <one-to-many name="prices">
+        <join-column name="source" referenced-column-name="source"/>
+        <join-column name="nodeType" referenced-column-name="nodeType"/>
+        <join-column name="nodeId" referenced-column-name="id"/>
+        <cascade>
+          <cascade-all/>
+        </cascade>
+      </one-to-many>
+      <many-to-many name="groups">
+        <join-table name="EventInfo_Group">
+          <join-column name="source" referenced-column-name="source"/>
+          <join-column name="nodeType" referenced-column-name="nodeType"/>
+          <join-column name="nodeId" referenced-column-name="id"/>
+        </join-table>
+        <cascade>
+          <cascade-all/>
+        </cascade>
+      </many-to-many>
+    </attributes>
+  </entity>
+
+</entity-mappings>
diff --git a/src/test/resources/META-INF/geoplace.xml b/src/test/resources/META-INF/geoplace.xml
new file mode 100644 (file)
index 0000000..e0c2c2a
--- /dev/null
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<entity-mappings
+    xmlns="http://java.sun.com/xml/ns/persistence/orm"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm_2_1.xsd"
+    version="2.1">
+
+  <package>de.juplo.yourshouter.api.model</package>
+  <entity class="GeoPlace" access="FIELD"/>
+
+</entity-mappings>
diff --git a/src/test/resources/META-INF/group.xml b/src/test/resources/META-INF/group.xml
new file mode 100644 (file)
index 0000000..07618cb
--- /dev/null
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<entity-mappings
+    xmlns="http://java.sun.com/xml/ns/persistence/orm"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm_2_1.xsd"
+    version="2.1">
+
+  <package>de.juplo.yourshouter.api.model</package>
+  <entity class="Group" access="FIELD">
+    <discriminator-value>9</discriminator-value>
+    <attributes>
+      <basic name="uri">
+        <column length="511"/>
+      </basic>
+      <basic name="teaser">
+        <column length="511"/>
+      </basic>
+      <element-collection name="contributors"/>
+      <element-collection name="emails"/>
+      <element-collection name="links"/>
+      <element-collection name="numbers"/>
+      <many-to-many name="media">
+        <join-table name="Node_Media">
+          <join-column name="source" referenced-column-name="source"/>
+          <join-column name="nodeType" referenced-column-name="nodeType"/>
+          <join-column name="nodeId" referenced-column-name="id"/>
+        </join-table>
+        <cascade>
+          <cascade-all/>
+        </cascade>
+      </many-to-many>
+      <one-to-many name="prices">
+        <join-column name="source" referenced-column-name="source"/>
+        <join-column name="nodeType" referenced-column-name="nodeType"/>
+        <join-column name="nodeId" referenced-column-name="id"/>
+        <cascade>
+          <cascade-all/>
+        </cascade>
+      </one-to-many>
+      <many-to-many name="groups">
+        <join-table name="EventInfo_Group">
+          <join-column name="source" referenced-column-name="source"/>
+          <join-column name="nodeType" referenced-column-name="nodeType"/>
+          <join-column name="nodeId" referenced-column-name="id"/>
+        </join-table>
+        <cascade>
+          <cascade-all/>
+        </cascade>
+      </many-to-many>
+    </attributes>
+  </entity>
+
+</entity-mappings>
diff --git a/src/test/resources/META-INF/legalperson.xml b/src/test/resources/META-INF/legalperson.xml
new file mode 100644 (file)
index 0000000..69e16d1
--- /dev/null
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<entity-mappings
+    xmlns="http://java.sun.com/xml/ns/persistence/orm"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm_2_1.xsd"
+    version="2.1">
+
+  <package>de.juplo.yourshouter.api.model</package>
+  <entity class="LegalPerson" access="FIELD">
+    <attributes>
+      <many-to-many name="categories">
+        <join-table name="LegalPerson_Category"/>
+        <cascade>
+          <cascade-all/>
+        </cascade>
+      </many-to-many>
+      <element-collection name="contributors"/>
+      <element-collection name="emails"/>
+      <element-collection name="links"/>
+      <element-collection name="numbers"/>
+      <many-to-many name="media">
+        <join-table name="Node_Media">
+          <join-column name="source" referenced-column-name="source"/>
+          <join-column name="nodeType" referenced-column-name="nodeType"/>
+          <join-column name="nodeId" referenced-column-name="id"/>
+        </join-table>
+        <cascade>
+          <cascade-all/>
+        </cascade>
+      </many-to-many>
+    </attributes>
+  </entity>
+
+</entity-mappings>
diff --git a/src/test/resources/META-INF/link.xml b/src/test/resources/META-INF/link.xml
new file mode 100644 (file)
index 0000000..23557dd
--- /dev/null
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<entity-mappings
+    xmlns="http://java.sun.com/xml/ns/persistence/orm"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm_2_1.xsd"
+    version="2.1">
+
+  <package>de.juplo.yourshouter.api.model</package>
+  <embeddable class="Link" access="FIELD">
+    <attributes>
+      <basic name="value">
+        <column length="1023"/>
+      </basic>
+      <many-to-one name="icon">
+        <cascade>
+          <cascade-all/>
+        </cascade>
+      </many-to-one>
+    </attributes>
+  </embeddable>
+
+</entity-mappings>
diff --git a/src/test/resources/META-INF/location.xml b/src/test/resources/META-INF/location.xml
new file mode 100644 (file)
index 0000000..3aa9d21
--- /dev/null
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<entity-mappings
+    xmlns="http://java.sun.com/xml/ns/persistence/orm"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm_2_1.xsd"
+    version="2.1">
+
+  <package>de.juplo.yourshouter.api.model</package>
+  <entity class="Location" access="FIELD">
+    <discriminator-value>14</discriminator-value>
+    <attributes>
+      <basic name="uri">
+        <column length="511"/>
+      </basic>
+      <many-to-many name="categories">
+        <join-table name="Location_Category"/>
+        <cascade>
+          <cascade-all/>
+        </cascade>
+      </many-to-many>
+      <many-to-many name="media">
+        <join-table name="Node_Media">
+          <join-column name="source" referenced-column-name="source"/>
+          <join-column name="nodeType" referenced-column-name="nodeType"/>
+          <join-column name="nodeId" referenced-column-name="id"/>
+        </join-table>
+        <cascade>
+          <cascade-all/>
+        </cascade>
+      </many-to-many>
+      <element-collection name="hours"/>
+      <element-collection name="emails"/>
+      <element-collection name="links"/>
+      <element-collection name="numbers"/>
+    </attributes>
+  </entity>
+
+</entity-mappings>
diff --git a/src/test/resources/META-INF/media.xml b/src/test/resources/META-INF/media.xml
new file mode 100644 (file)
index 0000000..61a6ffc
--- /dev/null
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<entity-mappings
+    xmlns="http://java.sun.com/xml/ns/persistence/orm"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm_2_1.xsd"
+    version="2.1">
+
+  <package>de.juplo.yourshouter.api.model</package>
+  <entity class="Media" access="FIELD">
+    <discriminator-value>6</discriminator-value>
+    <attributes>
+      <basic name="link">
+        <column length="511"/>
+      </basic>
+      <basic name="teaser">
+        <column length="1023"/>
+      </basic>
+      <basic name="text">
+        <column length="4095"/>
+      </basic>
+      <many-to-one name="photographer">
+        <cascade>
+          <cascade-all/>
+        </cascade>
+      </many-to-one>
+    </attributes>
+  </entity>
+
+</entity-mappings>
index 04f8993..952f873 100644 (file)
@@ -6,17 +6,41 @@
     version="2.1">
 
   <package>de.juplo.yourshouter.api.model</package>
+  <converter class="de.juplo.jpa.converters.URIConverter" auto-apply="true"/>
   <converter class="de.juplo.jpa.converters.ZonedDateTimeConverter" auto-apply="true"/>
   <converter class="de.juplo.jpa.converters.LocalDateConverter" auto-apply="true"/>
-  <mapped-superclass class="Node" access="FIELD">
+  <converter class="de.juplo.jpa.converters.LocalTimeConverter" auto-apply="true"/>
+  <converter class="de.juplo.yourshouter.api.persistence.jpa.StringFeatureConverter" auto-apply="true"/>
+  <converter class="de.juplo.yourshouter.api.persistence.jpa.StringTypeConverter" auto-apply="true"/>
+  <entity class="Node" access="FIELD">
+    <table>
+      <index name="uri" unique="true" column-list="source, nodeType, id, locale, version"/>
+    </table>
     <inheritance strategy="SINGLE_TABLE"/>
     <discriminator-column discriminator-type="INTEGER"/>
+    <id-class class="de.juplo.yourshouter.api.persistence.jpa.PrimaryKey"/> 
     <attributes>
-      <id name="id"/>
-      <transient name="features"/>
-      <transient name="fields"/>
-      <transient name="nodes"/>
+      <id name="source">
+        <column length="191" column-definition="VARCHAR(191)"/>
+      </id>
+      <id name="id">
+        <column name="id" length="191"/>
+      </id>
+      <id name="nodeType"/>
+      <basic name="name">
+        <column length="511"/>
+      </basic>
+      <basic name="locale">
+        <column length="127"/>
+      </basic>
+      <element-collection name="features"/>
+      <element-collection name="fields"/>
+      <many-to-many name="nodes">
+        <cascade>
+          <cascade-all/>
+        </cascade>
+      </many-to-many>
     </attributes>
-  </mapped-superclass>
+  </entity>
 
 </entity-mappings>
diff --git a/src/test/resources/META-INF/nodes.xml b/src/test/resources/META-INF/nodes.xml
new file mode 100644 (file)
index 0000000..e8004d9
--- /dev/null
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<entity-mappings
+    xmlns="http://java.sun.com/xml/ns/persistence/orm"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm_2_1.xsd"
+    version="2.1">
+
+  <package>de.juplo.yourshouter.api.model</package>
+  <entity class="Nodes" access="FIELD">
+    <attributes>
+      <id name="dbid">
+        <generated-value strategy="IDENTITY"/>
+      </id>
+      <many-to-many name="nodes">
+        <cascade>
+          <cascade-all/>
+        </cascade>
+      </many-to-many>
+    </attributes>
+  </entity>
+
+</entity-mappings>
diff --git a/src/test/resources/META-INF/nodestate.xml b/src/test/resources/META-INF/nodestate.xml
new file mode 100644 (file)
index 0000000..7290ea8
--- /dev/null
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<entity-mappings
+    xmlns="http://java.sun.com/xml/ns/persistence/orm"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm_2_1.xsd"
+    version="2.1">
+
+  <package>de.juplo.yourshouter.api.model</package>
+  <embeddable class="NodeState" access="FIELD">
+    <attributes>
+      <element-collection name="types"/>
+      <many-to-one name="node">
+        <cascade>
+          <cascade-all/>
+        </cascade>
+      </many-to-one>
+    </attributes>
+  </embeddable>
+
+</entity-mappings>
diff --git a/src/test/resources/META-INF/number.xml b/src/test/resources/META-INF/number.xml
new file mode 100644 (file)
index 0000000..e05e6d5
--- /dev/null
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<entity-mappings
+    xmlns="http://java.sun.com/xml/ns/persistence/orm"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm_2_1.xsd"
+    version="2.1">
+
+  <package>de.juplo.yourshouter.api.model</package>
+  <embeddable class="Number" access="FIELD">
+    <attributes>
+      <many-to-one name="icon">
+        <cascade>
+          <cascade-all/>
+        </cascade>
+      </many-to-one>
+    </attributes>
+  </embeddable>
+
+</entity-mappings>
diff --git a/src/test/resources/META-INF/openinghours.xml b/src/test/resources/META-INF/openinghours.xml
new file mode 100644 (file)
index 0000000..4f8c585
--- /dev/null
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<entity-mappings
+    xmlns="http://java.sun.com/xml/ns/persistence/orm"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm_2_1.xsd"
+    version="2.1">
+
+  <package>de.juplo.yourshouter.api.model</package>
+  <embeddable class="OpeningHours" access="FIELD"/>
+
+</entity-mappings>
diff --git a/src/test/resources/META-INF/organization.xml b/src/test/resources/META-INF/organization.xml
new file mode 100644 (file)
index 0000000..0631b2f
--- /dev/null
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<entity-mappings
+    xmlns="http://java.sun.com/xml/ns/persistence/orm"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm_2_1.xsd"
+    version="2.1">
+
+  <package>de.juplo.yourshouter.api.model</package>
+  <entity class="Organization" access="FIELD">
+    <discriminator-value>8</discriminator-value>
+    <attributes>
+      <element-collection name="contributors"/>
+    </attributes>
+  </entity>
+
+</entity-mappings>
index a7d213f..9f84f3c 100644 (file)
 
   <persistence-unit name="data-model">
     <description>Example, taken from the data-model package</description>
+    <mapping-file>META-INF/coordinates.xml</mapping-file>
+    <mapping-file>META-INF/address.xml</mapping-file>
+    <mapping-file>META-INF/link.xml</mapping-file>
+    <mapping-file>META-INF/email.xml</mapping-file>
+    <mapping-file>META-INF/number.xml</mapping-file>
+    <mapping-file>META-INF/openinghours.xml</mapping-file>
+    <mapping-file>META-INF/nodes.xml</mapping-file>
+    <mapping-file>META-INF/role.xml</mapping-file>
+    <mapping-file>META-INF/price.xml</mapping-file>
+    <mapping-file>META-INF/nodestate.xml</mapping-file>
+    <mapping-file>META-INF/dimensions.xml</mapping-file>
     <mapping-file>META-INF/node.xml</mapping-file>
+    <mapping-file>META-INF/category.xml</mapping-file>
+    <mapping-file>META-INF/media.xml</mapping-file>
+    <mapping-file>META-INF/geoplace.xml</mapping-file>
+    <mapping-file>META-INF/country.xml</mapping-file>
+    <mapping-file>META-INF/state.xml</mapping-file>
+    <mapping-file>META-INF/city.xml</mapping-file>
+    <mapping-file>META-INF/district.xml</mapping-file>
+    <mapping-file>META-INF/region.xml</mapping-file>
+    <mapping-file>META-INF/legalperson.xml</mapping-file>
+    <mapping-file>META-INF/person.xml</mapping-file>
+    <mapping-file>META-INF/organization.xml</mapping-file>
+    <mapping-file>META-INF/group.xml</mapping-file>
+    <mapping-file>META-INF/exhibition.xml</mapping-file>
+    <mapping-file>META-INF/custom.xml</mapping-file>
+    <mapping-file>META-INF/place.xml</mapping-file>
+    <mapping-file>META-INF/venue.xml</mapping-file>
+    <mapping-file>META-INF/location.xml</mapping-file>
+    <mapping-file>META-INF/subunit.xml</mapping-file>
+    <mapping-file>META-INF/event.xml</mapping-file>
     <mapping-file>META-INF/date.xml</mapping-file>
     <exclude-unlisted-classes>true</exclude-unlisted-classes>
     <properties>
diff --git a/src/test/resources/META-INF/person.xml b/src/test/resources/META-INF/person.xml
new file mode 100644 (file)
index 0000000..e3ae8e0
--- /dev/null
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<entity-mappings
+    xmlns="http://java.sun.com/xml/ns/persistence/orm"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm_2_1.xsd"
+    version="2.1">
+
+  <package>de.juplo.yourshouter.api.model</package>
+  <entity class="Person" access="FIELD">
+    <discriminator-value>7</discriminator-value>
+    <attributes>
+      <basic name="uri">
+        <column length="511"/>
+      </basic>
+    </attributes>
+  </entity>
+
+</entity-mappings>
diff --git a/src/test/resources/META-INF/place.xml b/src/test/resources/META-INF/place.xml
new file mode 100644 (file)
index 0000000..d5af07f
--- /dev/null
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<entity-mappings
+    xmlns="http://java.sun.com/xml/ns/persistence/orm"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm_2_1.xsd"
+    version="2.1">
+
+  <package>de.juplo.yourshouter.api.model</package>
+  <entity class="Place" access="FIELD">
+    <discriminator-value>12</discriminator-value>
+    <attributes>
+      <many-to-one name="parent"/>
+      <many-to-many name="regions">
+        <join-table name="Place_Region"/>
+        <cascade>
+          <cascade-all/>
+        </cascade>
+      </many-to-many>
+      <many-to-one name="country">
+        <cascade>
+          <cascade-all/>
+        </cascade>
+      </many-to-one>
+      <many-to-one name="state">
+        <cascade>
+          <cascade-all/>
+        </cascade>
+      </many-to-one>
+      <many-to-one name="city">
+        <cascade>
+          <cascade-all/>
+        </cascade>
+      </many-to-one>
+      <many-to-one name="district">
+        <cascade>
+          <cascade-all/>
+        </cascade>
+      </many-to-one>
+    </attributes>
+  </entity>
+
+</entity-mappings>
diff --git a/src/test/resources/META-INF/price.xml b/src/test/resources/META-INF/price.xml
new file mode 100644 (file)
index 0000000..c8cab81
--- /dev/null
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<entity-mappings
+    xmlns="http://java.sun.com/xml/ns/persistence/orm"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm_2_1.xsd"
+    version="2.1">
+
+  <package>de.juplo.yourshouter.api.model</package>
+  <entity class="Price" access="FIELD">
+    <attributes>
+      <id name="dbid">
+        <generated-value strategy="IDENTITY"/>
+      </id>
+      <element-collection name="emails"/>
+      <element-collection name="links"/>
+      <element-collection name="numbers"/>
+    </attributes>
+  </entity>
+
+</entity-mappings>
diff --git a/src/test/resources/META-INF/region.xml b/src/test/resources/META-INF/region.xml
new file mode 100644 (file)
index 0000000..e7149a9
--- /dev/null
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<entity-mappings
+    xmlns="http://java.sun.com/xml/ns/persistence/orm"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm_2_1.xsd"
+    version="2.1">
+
+  <package>de.juplo.yourshouter.api.model</package>
+  <entity class="Region" access="FIELD">
+    <discriminator-value>5</discriminator-value>
+    <attributes>
+      <basic name="order">
+        <column name="ord"/>
+      </basic>
+      <many-to-many name="cities">
+        <join-table name="Region_City"/>
+        <cascade>
+          <cascade-all/>
+        </cascade>
+      </many-to-many>
+    </attributes>
+  </entity>
+
+</entity-mappings>
diff --git a/src/test/resources/META-INF/role.xml b/src/test/resources/META-INF/role.xml
new file mode 100644 (file)
index 0000000..5a082ed
--- /dev/null
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<entity-mappings
+    xmlns="http://java.sun.com/xml/ns/persistence/orm"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm_2_1.xsd"
+    version="2.1">
+
+  <package>de.juplo.yourshouter.api.model</package>
+  <embeddable class="Role" access="FIELD">
+    <attributes>
+      <many-to-one name="contributor">
+        <cascade>
+          <cascade-all/>
+        </cascade>
+      </many-to-one>
+      <basic name="text">
+        <column length="511"/>
+      </basic>
+    </attributes>
+  </embeddable>
+
+</entity-mappings>
diff --git a/src/test/resources/META-INF/source.xml b/src/test/resources/META-INF/source.xml
new file mode 100644 (file)
index 0000000..2371400
--- /dev/null
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<entity-mappings
+    xmlns="http://java.sun.com/xml/ns/persistence/orm"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm_2_1.xsd"
+    version="2.1">
+
+  <package>de.juplo.yourshouter.api.persistence</package>
+  <entity class="Source" access="FIELD">
+    <table>
+      <index name="uri_sources" unique="true" column-list="uri"/>
+    </table>
+    <attributes>
+      <id name="uri">
+        <column length="191" column-definition="VARCHAR(191)"/>
+      </id>
+      <element-collection name="types"/>
+      <element-collection name="features"/>
+    </attributes>
+  </entity>
+
+</entity-mappings>
diff --git a/src/test/resources/META-INF/spring.factories b/src/test/resources/META-INF/spring.factories
new file mode 100644 (file)
index 0000000..ee8e05c
--- /dev/null
@@ -0,0 +1 @@
+org.springframework.boot.autoconfigure.EnableAutoConfiguration=de.juplo.yourshouter.api.persistence.jpa.JpaPersistenceAutoConfiguration
diff --git a/src/test/resources/META-INF/state.xml b/src/test/resources/META-INF/state.xml
new file mode 100644 (file)
index 0000000..b8a828f
--- /dev/null
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<entity-mappings
+    xmlns="http://java.sun.com/xml/ns/persistence/orm"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm_2_1.xsd"
+    version="2.1">
+
+  <package>de.juplo.yourshouter.api.model</package>
+  <entity class="State" access="FIELD">
+    <discriminator-value>2</discriminator-value>
+    <attributes>
+      <many-to-one name="country">
+        <cascade>
+          <cascade-all/>
+        </cascade>
+      </many-to-one>
+    </attributes>
+  </entity>
+
+</entity-mappings>
diff --git a/src/test/resources/META-INF/subunit.xml b/src/test/resources/META-INF/subunit.xml
new file mode 100644 (file)
index 0000000..713fa2d
--- /dev/null
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<entity-mappings
+    xmlns="http://java.sun.com/xml/ns/persistence/orm"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm_2_1.xsd"
+    version="2.1">
+
+  <package>de.juplo.yourshouter.api.model</package>
+  <entity class="Subunit" access="FIELD">
+    <discriminator-value>15</discriminator-value>
+    <attributes>
+      <basic name="teaser">
+        <column length="1023"/>
+      </basic>
+      <basic name="text">
+        <column length="4095"/>
+      </basic>
+      <many-to-one name="parent">
+        <cascade>
+          <cascade-all/>
+        </cascade>
+      </many-to-one>
+      <many-to-many name="media">
+        <join-table name="Node_Media">
+          <join-column name="source" referenced-column-name="source"/>
+          <join-column name="nodeType" referenced-column-name="nodeType"/>
+          <join-column name="nodeId" referenced-column-name="id"/>
+        </join-table>
+        <cascade>
+          <cascade-all/>
+        </cascade>
+      </many-to-many>
+    </attributes>
+  </entity>
+
+</entity-mappings>
diff --git a/src/test/resources/META-INF/venue.xml b/src/test/resources/META-INF/venue.xml
new file mode 100644 (file)
index 0000000..ff6afdd
--- /dev/null
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<entity-mappings
+    xmlns="http://java.sun.com/xml/ns/persistence/orm"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm_2_1.xsd"
+    version="2.1">
+
+  <package>de.juplo.yourshouter.api.model</package>
+  <entity class="Venue" access="FIELD">
+    <discriminator-value>13</discriminator-value>
+    <attributes>
+      <basic name="key">
+        <column name="gemkey" length="31"/>
+      </basic>
+    </attributes>
+  </entity>
+
+</entity-mappings>