testOffsetDateTime();
}
+ @Test
+ public void testOffsetDateTimeXml()
+ {
+ em = Persistence.createEntityManagerFactory("xml").createEntityManager();
+ testOffsetDateTime();
+ }
+
public void testOffsetDateTime()
{
EierlegendeWollmilchSau ews;
assertEquals(odt.toInstant(), ews.odt.toInstant());
}
+
@Test
public void testZonedDateTimeAnnotated()
{
testZonedDateTime();
}
+ @Test
+ public void testZonedDateTimeXml()
+ {
+ em = Persistence.createEntityManagerFactory("xml").createEntityManager();
+ testZonedDateTime();
+ }
+
public void testZonedDateTime()
{
EierlegendeWollmilchSau ews;
--- /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">
+
+ <converter class="de.juplo.jpa.converters.ZonedDateTimeConverter" auto-apply="true"/>
+ <converter class="de.juplo.jpa.converters.OffsetDateTimeConverter" auto-apply="true"/>
+
+ <entity class="de.juplo.jpa.converters.EierlegendeWollmilchSau" access="PROPERTY">
+ <attributes>
+ <id name="id">
+ <generated-value/>
+ </id>
+ </attributes>
+ </entity>
+
+</entity-mappings>
</properties>
</persistence-unit>
+ <persistence-unit name="xml">
+ <description>Classes are mapped with XML-configuration-files</description>
+ <mapping-file>META-INF/mapping.xml</mapping-file>
+ <exclude-unlisted-classes>true</exclude-unlisted-classes>
+ <properties>
+ <property name="javax.persistence.jdbc.driver" value="org.h2.Driver"/>
+ <property name="javax.persistence.jdbc.user" value="sa"/>
+ <property name="javax.persistence.jdbc.password" value=""/>
+ <property name="javax.persistence.jdbc.url" value="jdbc:h2:mem:"/>
+ <property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect"/>
+ <property name="hibernate.hbm2ddl.auto" value="create"/>
+ <property name="hibernate.show_sql" value="true"/>
+ </properties>
+ </persistence-unit>
+
</persistence>