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;
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());
}
--- /dev/null
+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();
+ }
+}
--- /dev/null
+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);
+ }
+}
--- /dev/null
+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));
+ }
+}
--- /dev/null
+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);
+ }
+}
--- /dev/null
+<?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>
--- /dev/null
+<?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>
--- /dev/null
+<?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>
--- /dev/null
+<?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>
--- /dev/null
+<?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>
--- /dev/null
+<?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>
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>
--- /dev/null
+<?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>
--- /dev/null
+<?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>
--- /dev/null
+<?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>
--- /dev/null
+<?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>
--- /dev/null
+<?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>
--- /dev/null
+<?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>
--- /dev/null
+<?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>
--- /dev/null
+<?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>
--- /dev/null
+<?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>
--- /dev/null
+<?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>
--- /dev/null
+<?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>
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>
--- /dev/null
+<?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>
--- /dev/null
+<?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>
--- /dev/null
+<?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>
--- /dev/null
+<?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>
--- /dev/null
+<?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>
<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>
--- /dev/null
+<?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>
--- /dev/null
+<?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>
--- /dev/null
+<?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>
--- /dev/null
+<?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>
--- /dev/null
+<?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>
--- /dev/null
+<?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>
--- /dev/null
+org.springframework.boot.autoconfigure.EnableAutoConfiguration=de.juplo.yourshouter.api.persistence.jpa.JpaPersistenceAutoConfiguration
--- /dev/null
+<?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>
--- /dev/null
+<?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>
--- /dev/null
+<?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>