You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by nt...@apache.org on 2017/08/21 09:49:11 UTC
[2/7] cayenne git commit: CAY-2352 Clean up build scripts and code to
support Java 8 move java8 data types into server
CAY-2352 Clean up build scripts and code to support Java 8
move java8 data types into server
Project: http://git-wip-us.apache.org/repos/asf/cayenne/repo
Commit: http://git-wip-us.apache.org/repos/asf/cayenne/commit/4eb6a055
Tree: http://git-wip-us.apache.org/repos/asf/cayenne/tree/4eb6a055
Diff: http://git-wip-us.apache.org/repos/asf/cayenne/diff/4eb6a055
Branch: refs/heads/master
Commit: 4eb6a05534f0faa77310789397e0ea15c9e57a75
Parents: b332610
Author: Nikita Timofeev <st...@gmail.com>
Authored: Fri Aug 18 14:58:53 2017 +0300
Committer: Nikita Timofeev <st...@gmail.com>
Committed: Fri Aug 18 14:58:53 2017 +0300
----------------------------------------------------------------------
cayenne-java8/pom.xml | 19 ---
.../org/apache/cayenne/java8/Java8Module.java | 8 +-
.../java8/Java8ServerModuleProvider.java | 2 +
.../access/types/LocalDateTimeValueType.java | 56 --------
.../java8/access/types/LocalDateValueType.java | 56 --------
.../java8/access/types/LocalTimeValueType.java | 56 --------
.../cayenne/java8/Java8ModuleProviderTest.java | 1 +
.../org/apache/cayenne/java8/Java8TimeIT.java | 138 ------------------
.../org/apache/cayenne/java8/RuntimeBase.java | 33 -----
.../cayenne/java8/db/LocalDateTestEntity.java | 27 ----
.../java8/db/LocalDateTimeTestEntity.java | 27 ----
.../cayenne/java8/db/LocalTimeTestEntity.java | 27 ----
.../java8/db/auto/_LocalDateTestEntity.java | 87 ------------
.../java8/db/auto/_LocalDateTimeTestEntity.java | 87 ------------
.../java8/db/auto/_LocalTimeTestEntity.java | 87 ------------
.../src/test/resources/cayenne-java8.xml | 16 ---
cayenne-java8/src/test/resources/java8.map.xml | 28 ----
.../access/types/LocalDateTimeValueType.java | 54 +++++++
.../access/types/LocalDateValueType.java | 54 +++++++
.../access/types/LocalTimeValueType.java | 54 +++++++
.../configuration/server/ServerModule.java | 9 +-
.../cayenne/access/types/Java8TimeIT.java | 139 +++++++++++++++++++
.../testdo/java8/LocalDateTestEntity.java | 27 ++++
.../testdo/java8/LocalDateTimeTestEntity.java | 27 ++++
.../testdo/java8/LocalTimeTestEntity.java | 27 ++++
.../testdo/java8/auto/_LocalDateTestEntity.java | 87 ++++++++++++
.../java8/auto/_LocalDateTimeTestEntity.java | 87 ++++++++++++
.../testdo/java8/auto/_LocalTimeTestEntity.java | 87 ++++++++++++
.../cayenne/unit/di/server/CayenneProjects.java | 1 +
.../cayenne/unit/di/server/SchemaBuilder.java | 2 +-
.../unit/di/server/ServerCaseModule.java | 8 +-
.../src/test/resources/cayenne-java8.xml | 5 +
cayenne-server/src/test/resources/java8.map.xml | 28 ++++
33 files changed, 701 insertions(+), 750 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cayenne/blob/4eb6a055/cayenne-java8/pom.xml
----------------------------------------------------------------------
diff --git a/cayenne-java8/pom.xml b/cayenne-java8/pom.xml
index 480fd92..f30e7c8 100644
--- a/cayenne-java8/pom.xml
+++ b/cayenne-java8/pom.xml
@@ -78,25 +78,6 @@
</executions>
</plugin>
<plugin>
- <groupId>org.apache.cayenne.plugins</groupId>
- <artifactId>cayenne-maven-plugin</artifactId>
- <version>${project.version}</version>
- <configuration>
- <map>${project.basedir}/src/test/resources/java8.map.xml</map>
- <destDir>${project.basedir}/src/test/java</destDir>
- <defaultPackage>org.apache.cayenne.java8.db</defaultPackage>
- <superPkg>org.apache.cayenne.java8.db.auto</superPkg>
- </configuration>
- <executions>
- <execution>
- <id>default-cli</id>
- <goals>
- <goal>cgen</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
<artifactId>maven-checkstyle-plugin</artifactId>
<!--<configuration> <suppressionsLocation>${project.basedir}/cayenne-checkstyle-suppression.xml</suppressionsLocation>
</configuration> -->
http://git-wip-us.apache.org/repos/asf/cayenne/blob/4eb6a055/cayenne-java8/src/main/java/org/apache/cayenne/java8/Java8Module.java
----------------------------------------------------------------------
diff --git a/cayenne-java8/src/main/java/org/apache/cayenne/java8/Java8Module.java b/cayenne-java8/src/main/java/org/apache/cayenne/java8/Java8Module.java
index 434595d..91cea24 100644
--- a/cayenne-java8/src/main/java/org/apache/cayenne/java8/Java8Module.java
+++ b/cayenne-java8/src/main/java/org/apache/cayenne/java8/Java8Module.java
@@ -21,13 +21,15 @@ package org.apache.cayenne.java8;
import org.apache.cayenne.configuration.server.ServerModule;
import org.apache.cayenne.di.Binder;
import org.apache.cayenne.di.Module;
-import org.apache.cayenne.java8.access.types.LocalDateTimeValueType;
-import org.apache.cayenne.java8.access.types.LocalDateValueType;
-import org.apache.cayenne.java8.access.types.LocalTimeValueType;
+import org.apache.cayenne.access.types.LocalDateTimeValueType;
+import org.apache.cayenne.access.types.LocalDateValueType;
+import org.apache.cayenne.access.types.LocalTimeValueType;
/**
* @since 4.0
+ * @deprecated since 4.1 Java 8 types are in cayenne-server by default
*/
+@Deprecated
public class Java8Module implements Module {
@Override
http://git-wip-us.apache.org/repos/asf/cayenne/blob/4eb6a055/cayenne-java8/src/main/java/org/apache/cayenne/java8/Java8ServerModuleProvider.java
----------------------------------------------------------------------
diff --git a/cayenne-java8/src/main/java/org/apache/cayenne/java8/Java8ServerModuleProvider.java b/cayenne-java8/src/main/java/org/apache/cayenne/java8/Java8ServerModuleProvider.java
index 5351a36..c35024c 100644
--- a/cayenne-java8/src/main/java/org/apache/cayenne/java8/Java8ServerModuleProvider.java
+++ b/cayenne-java8/src/main/java/org/apache/cayenne/java8/Java8ServerModuleProvider.java
@@ -26,7 +26,9 @@ import java.util.Collections;
/**
* @since 4.0
+ * @deprecated since 4.1 java 8 types are in cayenne-server by default
*/
+@Deprecated
public class Java8ServerModuleProvider implements CayenneServerModuleProvider {
@Override
http://git-wip-us.apache.org/repos/asf/cayenne/blob/4eb6a055/cayenne-java8/src/main/java/org/apache/cayenne/java8/access/types/LocalDateTimeValueType.java
----------------------------------------------------------------------
diff --git a/cayenne-java8/src/main/java/org/apache/cayenne/java8/access/types/LocalDateTimeValueType.java b/cayenne-java8/src/main/java/org/apache/cayenne/java8/access/types/LocalDateTimeValueType.java
deleted file mode 100644
index a877b7a..0000000
--- a/cayenne-java8/src/main/java/org/apache/cayenne/java8/access/types/LocalDateTimeValueType.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- ****************************************************************/
-
-package org.apache.cayenne.java8.access.types;
-
-import java.sql.Timestamp;
-import java.time.LocalDateTime;
-
-import org.apache.cayenne.access.types.ValueObjectType;
-
-/**
- * @since 4.0
- */
-public class LocalDateTimeValueType implements ValueObjectType<LocalDateTime, Timestamp> {
-
- @Override
- public Class<Timestamp> getTargetType() {
- return Timestamp.class;
- }
-
- @Override
- public Class<LocalDateTime> getValueType() {
- return LocalDateTime.class;
- }
-
- @Override
- public LocalDateTime toJavaObject(Timestamp value) {
- return value.toLocalDateTime();
- }
-
- @Override
- public Timestamp fromJavaObject(LocalDateTime object) {
- return Timestamp.valueOf(object);
- }
-
- @Override
- public String toCacheKey(LocalDateTime object) {
- return object.toString();
- }
-}
http://git-wip-us.apache.org/repos/asf/cayenne/blob/4eb6a055/cayenne-java8/src/main/java/org/apache/cayenne/java8/access/types/LocalDateValueType.java
----------------------------------------------------------------------
diff --git a/cayenne-java8/src/main/java/org/apache/cayenne/java8/access/types/LocalDateValueType.java b/cayenne-java8/src/main/java/org/apache/cayenne/java8/access/types/LocalDateValueType.java
deleted file mode 100644
index 03e259c..0000000
--- a/cayenne-java8/src/main/java/org/apache/cayenne/java8/access/types/LocalDateValueType.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- ****************************************************************/
-
-package org.apache.cayenne.java8.access.types;
-
-import java.sql.Date;
-import java.time.LocalDate;
-
-import org.apache.cayenne.access.types.ValueObjectType;
-
-/**
- * @since 4.0
- */
-public class LocalDateValueType implements ValueObjectType<LocalDate, Date> {
-
- @Override
- public Class<Date> getTargetType() {
- return Date.class;
- }
-
- @Override
- public Class<LocalDate> getValueType() {
- return LocalDate.class;
- }
-
- @Override
- public LocalDate toJavaObject(Date value) {
- return value.toLocalDate();
- }
-
- @Override
- public Date fromJavaObject(LocalDate object) {
- return Date.valueOf(object);
- }
-
- @Override
- public String toCacheKey(LocalDate object) {
- return object.toString();
- }
-}
http://git-wip-us.apache.org/repos/asf/cayenne/blob/4eb6a055/cayenne-java8/src/main/java/org/apache/cayenne/java8/access/types/LocalTimeValueType.java
----------------------------------------------------------------------
diff --git a/cayenne-java8/src/main/java/org/apache/cayenne/java8/access/types/LocalTimeValueType.java b/cayenne-java8/src/main/java/org/apache/cayenne/java8/access/types/LocalTimeValueType.java
deleted file mode 100644
index 7843a3d..0000000
--- a/cayenne-java8/src/main/java/org/apache/cayenne/java8/access/types/LocalTimeValueType.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- ****************************************************************/
-
-package org.apache.cayenne.java8.access.types;
-
-import java.sql.Time;
-import java.time.LocalTime;
-
-import org.apache.cayenne.access.types.ValueObjectType;
-
-/**
- * @since 4.0
- */
-public class LocalTimeValueType implements ValueObjectType<LocalTime, Time> {
-
- @Override
- public Class<Time> getTargetType() {
- return Time.class;
- }
-
- @Override
- public Class<LocalTime> getValueType() {
- return LocalTime.class;
- }
-
- @Override
- public LocalTime toJavaObject(Time value) {
- return value.toLocalTime();
- }
-
- @Override
- public Time fromJavaObject(LocalTime object) {
- return Time.valueOf(object);
- }
-
- @Override
- public String toCacheKey(LocalTime object) {
- return object.toString();
- }
-}
http://git-wip-us.apache.org/repos/asf/cayenne/blob/4eb6a055/cayenne-java8/src/test/java/org/apache/cayenne/java8/Java8ModuleProviderTest.java
----------------------------------------------------------------------
diff --git a/cayenne-java8/src/test/java/org/apache/cayenne/java8/Java8ModuleProviderTest.java b/cayenne-java8/src/test/java/org/apache/cayenne/java8/Java8ModuleProviderTest.java
index a080230..3aec491 100644
--- a/cayenne-java8/src/test/java/org/apache/cayenne/java8/Java8ModuleProviderTest.java
+++ b/cayenne-java8/src/test/java/org/apache/cayenne/java8/Java8ModuleProviderTest.java
@@ -22,6 +22,7 @@ import org.apache.cayenne.configuration.server.CayenneServerModuleProvider;
import org.apache.cayenne.unit.util.ModuleProviderChecker;
import org.junit.Test;
+@Deprecated
public class Java8ModuleProviderTest {
@Test
http://git-wip-us.apache.org/repos/asf/cayenne/blob/4eb6a055/cayenne-java8/src/test/java/org/apache/cayenne/java8/Java8TimeIT.java
----------------------------------------------------------------------
diff --git a/cayenne-java8/src/test/java/org/apache/cayenne/java8/Java8TimeIT.java b/cayenne-java8/src/test/java/org/apache/cayenne/java8/Java8TimeIT.java
deleted file mode 100644
index 8524aa1..0000000
--- a/cayenne-java8/src/test/java/org/apache/cayenne/java8/Java8TimeIT.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- ****************************************************************/
-
-package org.apache.cayenne.java8;
-
-import org.apache.cayenne.ObjectContext;
-import org.apache.cayenne.java8.db.LocalDateTestEntity;
-import org.apache.cayenne.java8.db.LocalDateTimeTestEntity;
-import org.apache.cayenne.java8.db.LocalTimeTestEntity;
-import org.apache.cayenne.query.ObjectSelect;
-import org.apache.cayenne.test.jdbc.DBHelper;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-
-import java.sql.SQLException;
-import java.time.LocalDate;
-import java.time.LocalDateTime;
-import java.time.LocalTime;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-public class Java8TimeIT extends RuntimeBase {
-
- @Before
- public void before() throws SQLException {
- DBHelper dbHelper = new DBHelper(runtime.getDataSource());
- dbHelper.deleteAll("LOCAL_DATE_TEST");
- dbHelper.deleteAll("LOCAL_DATETIME_TEST");
- dbHelper.deleteAll("LOCAL_TIME_TEST");
- }
-
- @Test
- public void testJava8LocalDate_Null() {
- ObjectContext context = runtime.newContext();
-
- LocalDateTestEntity localDateTestEntity = context.newObject(LocalDateTestEntity.class);
- localDateTestEntity.setDate(null);
-
- context.commitChanges();
-
- LocalDateTestEntity testRead = ObjectSelect.query(LocalDateTestEntity.class).selectOne(context);
-
- Assert.assertNull(testRead.getDate());
- }
-
- @Test
- public void testJava8LocalDate() {
- ObjectContext context = runtime.newContext();
-
- LocalDateTestEntity localDateTestEntity = context.newObject(LocalDateTestEntity.class);
- LocalDate localDate = LocalDate.now();
- localDateTestEntity.setDate(localDate);
-
- context.commitChanges();
-
- LocalDateTestEntity testRead = ObjectSelect.query(LocalDateTestEntity.class).selectOne(context);
-
- assertNotNull(testRead.getDate());
- assertEquals(LocalDate.class, testRead.getDate().getClass());
- assertEquals(localDate, testRead.getDate());
- }
-
- @Test
- public void testJava8LocalTime() {
- ObjectContext context = runtime.newContext();
-
- LocalTimeTestEntity localTimeTestEntity = context.newObject(LocalTimeTestEntity.class);
- LocalTime localTime = LocalTime.now();
- localTimeTestEntity.setTime(localTime);
-
- context.commitChanges();
-
- LocalTimeTestEntity testRead = ObjectSelect.query(LocalTimeTestEntity.class).selectOne(context);
-
- assertNotNull(testRead.getTime());
- assertEquals(LocalTime.class, testRead.getTime().getClass());
- assertEquals(localTime.toSecondOfDay(), testRead.getTime().toSecondOfDay());
-
- }
-
- @Test
- public void testJava8LocalDateTime() {
- ObjectContext context = runtime.newContext();
-
- LocalDateTimeTestEntity localDateTimeTestEntity = context.newObject(LocalDateTimeTestEntity.class);
- LocalDateTime localDateTime = LocalDateTime.now();
- localDateTimeTestEntity.setTimestamp(localDateTime);
-
- context.commitChanges();
-
- LocalDateTimeTestEntity testRead = ObjectSelect.query(LocalDateTimeTestEntity.class).selectOne(context);
-
- assertNotNull(testRead.getTimestamp());
- assertEquals(LocalDateTime.class, testRead.getTimestamp().getClass());
- assertEquals(localDateTime, testRead.getTimestamp());
-
- }
-
- @Test
- public void columnSelectWithJava8Type() {
- ObjectContext context = runtime.newContext();
- LocalDateTime localDateTime = LocalDateTime.now();
-
- LocalDateTimeTestEntity localDateTimeTestEntity = context.newObject(LocalDateTimeTestEntity.class);
- localDateTimeTestEntity.setTimestamp(localDateTime);
-
- context.commitChanges();
-
- LocalDateTime value = ObjectSelect.query(LocalDateTimeTestEntity.class)
- .column(LocalDateTimeTestEntity.TIMESTAMP)
- .selectOne(context);
- assertEquals(localDateTime, value);
-
- LocalDateTime value2 = ObjectSelect.query(LocalDateTimeTestEntity.class)
- .min(LocalDateTimeTestEntity.TIMESTAMP)
- .selectOne(context);
- assertEquals(localDateTime, value2);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/cayenne/blob/4eb6a055/cayenne-java8/src/test/java/org/apache/cayenne/java8/RuntimeBase.java
----------------------------------------------------------------------
diff --git a/cayenne-java8/src/test/java/org/apache/cayenne/java8/RuntimeBase.java b/cayenne-java8/src/test/java/org/apache/cayenne/java8/RuntimeBase.java
deleted file mode 100644
index 4a8df90..0000000
--- a/cayenne-java8/src/test/java/org/apache/cayenne/java8/RuntimeBase.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- ****************************************************************/
-
-package org.apache.cayenne.java8;
-
-import org.apache.cayenne.configuration.server.ServerRuntime;
-import org.junit.Before;
-
-public class RuntimeBase {
-
- protected ServerRuntime runtime;
-
- @Before
- public void setUpRuntime() {
- this.runtime = ServerRuntime.builder().addConfig("cayenne-java8.xml").build();
- }
-}
http://git-wip-us.apache.org/repos/asf/cayenne/blob/4eb6a055/cayenne-java8/src/test/java/org/apache/cayenne/java8/db/LocalDateTestEntity.java
----------------------------------------------------------------------
diff --git a/cayenne-java8/src/test/java/org/apache/cayenne/java8/db/LocalDateTestEntity.java b/cayenne-java8/src/test/java/org/apache/cayenne/java8/db/LocalDateTestEntity.java
deleted file mode 100644
index 5e2f865..0000000
--- a/cayenne-java8/src/test/java/org/apache/cayenne/java8/db/LocalDateTestEntity.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- ****************************************************************/
-package org.apache.cayenne.java8.db;
-
-import org.apache.cayenne.java8.db.auto._LocalDateTestEntity;
-
-public class LocalDateTestEntity extends _LocalDateTestEntity {
-
- private static final long serialVersionUID = 1L;
-
-}
http://git-wip-us.apache.org/repos/asf/cayenne/blob/4eb6a055/cayenne-java8/src/test/java/org/apache/cayenne/java8/db/LocalDateTimeTestEntity.java
----------------------------------------------------------------------
diff --git a/cayenne-java8/src/test/java/org/apache/cayenne/java8/db/LocalDateTimeTestEntity.java b/cayenne-java8/src/test/java/org/apache/cayenne/java8/db/LocalDateTimeTestEntity.java
deleted file mode 100644
index ee25e2c..0000000
--- a/cayenne-java8/src/test/java/org/apache/cayenne/java8/db/LocalDateTimeTestEntity.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- ****************************************************************/
-package org.apache.cayenne.java8.db;
-
-import org.apache.cayenne.java8.db.auto._LocalDateTimeTestEntity;
-
-public class LocalDateTimeTestEntity extends _LocalDateTimeTestEntity {
-
- private static final long serialVersionUID = 1L;
-
-}
http://git-wip-us.apache.org/repos/asf/cayenne/blob/4eb6a055/cayenne-java8/src/test/java/org/apache/cayenne/java8/db/LocalTimeTestEntity.java
----------------------------------------------------------------------
diff --git a/cayenne-java8/src/test/java/org/apache/cayenne/java8/db/LocalTimeTestEntity.java b/cayenne-java8/src/test/java/org/apache/cayenne/java8/db/LocalTimeTestEntity.java
deleted file mode 100644
index 79c37e1..0000000
--- a/cayenne-java8/src/test/java/org/apache/cayenne/java8/db/LocalTimeTestEntity.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- ****************************************************************/
-package org.apache.cayenne.java8.db;
-
-import org.apache.cayenne.java8.db.auto._LocalTimeTestEntity;
-
-public class LocalTimeTestEntity extends _LocalTimeTestEntity {
-
- private static final long serialVersionUID = 1L;
-
-}
http://git-wip-us.apache.org/repos/asf/cayenne/blob/4eb6a055/cayenne-java8/src/test/java/org/apache/cayenne/java8/db/auto/_LocalDateTestEntity.java
----------------------------------------------------------------------
diff --git a/cayenne-java8/src/test/java/org/apache/cayenne/java8/db/auto/_LocalDateTestEntity.java b/cayenne-java8/src/test/java/org/apache/cayenne/java8/db/auto/_LocalDateTestEntity.java
deleted file mode 100644
index 8b41f9c..0000000
--- a/cayenne-java8/src/test/java/org/apache/cayenne/java8/db/auto/_LocalDateTestEntity.java
+++ /dev/null
@@ -1,87 +0,0 @@
-package org.apache.cayenne.java8.db.auto;
-
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.time.LocalDate;
-
-import org.apache.cayenne.BaseDataObject;
-import org.apache.cayenne.exp.Property;
-
-/**
- * Class _LocalDateTestEntity was generated by Cayenne.
- * It is probably a good idea to avoid changing this class manually,
- * since it may be overwritten next time code is regenerated.
- * If you need to make any customizations, please use subclass.
- */
-public abstract class _LocalDateTestEntity extends BaseDataObject {
-
- private static final long serialVersionUID = 1L;
-
- public static final String ID_PK_COLUMN = "ID";
-
- public static final Property<LocalDate> DATE = Property.create("date", LocalDate.class);
-
- protected LocalDate date;
-
-
- public void setDate(LocalDate date) {
- beforePropertyWrite("date", this.date, date);
- this.date = date;
- }
-
- public LocalDate getDate() {
- beforePropertyRead("date");
- return date;
- }
-
- @Override
- public Object readPropertyDirectly(String propName) {
- if(propName == null) {
- throw new IllegalArgumentException();
- }
-
- switch(propName) {
- case "date":
- return this.date;
- default:
- return super.readPropertyDirectly(propName);
- }
- }
-
- @Override
- public void writePropertyDirectly(String propName, Object val) {
- if(propName == null) {
- throw new IllegalArgumentException();
- }
-
- switch (propName) {
- case "date":
- this.date = (LocalDate)val;
- break;
- default:
- super.writePropertyDirectly(propName, val);
- }
- }
-
- private void writeObject(ObjectOutputStream out) throws IOException {
- writeSerialized(out);
- }
-
- private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
- readSerialized(in);
- }
-
- @Override
- protected void writeState(ObjectOutputStream out) throws IOException {
- super.writeState(out);
- out.writeObject(date);
- }
-
- @Override
- protected void readState(ObjectInputStream in) throws IOException, ClassNotFoundException {
- super.readState(in);
- date = (LocalDate)in.readObject();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/cayenne/blob/4eb6a055/cayenne-java8/src/test/java/org/apache/cayenne/java8/db/auto/_LocalDateTimeTestEntity.java
----------------------------------------------------------------------
diff --git a/cayenne-java8/src/test/java/org/apache/cayenne/java8/db/auto/_LocalDateTimeTestEntity.java b/cayenne-java8/src/test/java/org/apache/cayenne/java8/db/auto/_LocalDateTimeTestEntity.java
deleted file mode 100644
index b630aad..0000000
--- a/cayenne-java8/src/test/java/org/apache/cayenne/java8/db/auto/_LocalDateTimeTestEntity.java
+++ /dev/null
@@ -1,87 +0,0 @@
-package org.apache.cayenne.java8.db.auto;
-
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.time.LocalDateTime;
-
-import org.apache.cayenne.BaseDataObject;
-import org.apache.cayenne.exp.Property;
-
-/**
- * Class _LocalDateTimeTestEntity was generated by Cayenne.
- * It is probably a good idea to avoid changing this class manually,
- * since it may be overwritten next time code is regenerated.
- * If you need to make any customizations, please use subclass.
- */
-public abstract class _LocalDateTimeTestEntity extends BaseDataObject {
-
- private static final long serialVersionUID = 1L;
-
- public static final String ID_PK_COLUMN = "ID";
-
- public static final Property<LocalDateTime> TIMESTAMP = Property.create("timestamp", LocalDateTime.class);
-
- protected LocalDateTime timestamp;
-
-
- public void setTimestamp(LocalDateTime timestamp) {
- beforePropertyWrite("timestamp", this.timestamp, timestamp);
- this.timestamp = timestamp;
- }
-
- public LocalDateTime getTimestamp() {
- beforePropertyRead("timestamp");
- return timestamp;
- }
-
- @Override
- public Object readPropertyDirectly(String propName) {
- if(propName == null) {
- throw new IllegalArgumentException();
- }
-
- switch(propName) {
- case "timestamp":
- return this.timestamp;
- default:
- return super.readPropertyDirectly(propName);
- }
- }
-
- @Override
- public void writePropertyDirectly(String propName, Object val) {
- if(propName == null) {
- throw new IllegalArgumentException();
- }
-
- switch (propName) {
- case "timestamp":
- this.timestamp = (LocalDateTime)val;
- break;
- default:
- super.writePropertyDirectly(propName, val);
- }
- }
-
- private void writeObject(ObjectOutputStream out) throws IOException {
- writeSerialized(out);
- }
-
- private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
- readSerialized(in);
- }
-
- @Override
- protected void writeState(ObjectOutputStream out) throws IOException {
- super.writeState(out);
- out.writeObject(timestamp);
- }
-
- @Override
- protected void readState(ObjectInputStream in) throws IOException, ClassNotFoundException {
- super.readState(in);
- timestamp = (LocalDateTime)in.readObject();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/cayenne/blob/4eb6a055/cayenne-java8/src/test/java/org/apache/cayenne/java8/db/auto/_LocalTimeTestEntity.java
----------------------------------------------------------------------
diff --git a/cayenne-java8/src/test/java/org/apache/cayenne/java8/db/auto/_LocalTimeTestEntity.java b/cayenne-java8/src/test/java/org/apache/cayenne/java8/db/auto/_LocalTimeTestEntity.java
deleted file mode 100644
index f1496d3..0000000
--- a/cayenne-java8/src/test/java/org/apache/cayenne/java8/db/auto/_LocalTimeTestEntity.java
+++ /dev/null
@@ -1,87 +0,0 @@
-package org.apache.cayenne.java8.db.auto;
-
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.time.LocalTime;
-
-import org.apache.cayenne.BaseDataObject;
-import org.apache.cayenne.exp.Property;
-
-/**
- * Class _LocalTimeTestEntity was generated by Cayenne.
- * It is probably a good idea to avoid changing this class manually,
- * since it may be overwritten next time code is regenerated.
- * If you need to make any customizations, please use subclass.
- */
-public abstract class _LocalTimeTestEntity extends BaseDataObject {
-
- private static final long serialVersionUID = 1L;
-
- public static final String ID_PK_COLUMN = "ID";
-
- public static final Property<LocalTime> TIME = Property.create("time", LocalTime.class);
-
- protected LocalTime time;
-
-
- public void setTime(LocalTime time) {
- beforePropertyWrite("time", this.time, time);
- this.time = time;
- }
-
- public LocalTime getTime() {
- beforePropertyRead("time");
- return time;
- }
-
- @Override
- public Object readPropertyDirectly(String propName) {
- if(propName == null) {
- throw new IllegalArgumentException();
- }
-
- switch(propName) {
- case "time":
- return this.time;
- default:
- return super.readPropertyDirectly(propName);
- }
- }
-
- @Override
- public void writePropertyDirectly(String propName, Object val) {
- if(propName == null) {
- throw new IllegalArgumentException();
- }
-
- switch (propName) {
- case "time":
- this.time = (LocalTime)val;
- break;
- default:
- super.writePropertyDirectly(propName, val);
- }
- }
-
- private void writeObject(ObjectOutputStream out) throws IOException {
- writeSerialized(out);
- }
-
- private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
- readSerialized(in);
- }
-
- @Override
- protected void writeState(ObjectOutputStream out) throws IOException {
- super.writeState(out);
- out.writeObject(time);
- }
-
- @Override
- protected void readState(ObjectInputStream in) throws IOException, ClassNotFoundException {
- super.readState(in);
- time = (LocalTime)in.readObject();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/cayenne/blob/4eb6a055/cayenne-java8/src/test/resources/cayenne-java8.xml
----------------------------------------------------------------------
diff --git a/cayenne-java8/src/test/resources/cayenne-java8.xml b/cayenne-java8/src/test/resources/cayenne-java8.xml
deleted file mode 100644
index cd4a0c4..0000000
--- a/cayenne-java8/src/test/resources/cayenne-java8.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<domain xmlns="http://cayenne.apache.org/schema/10/domain"
- project-version="10">
- <map name="java8"/>
- <node name="datanode"
- factory="org.apache.cayenne.configuration.server.XMLPoolingDataSourceFactory"
- schema-update-strategy="org.apache.cayenne.access.dbsync.CreateIfNoSchemaStrategy">
- <map-ref name="java8"/>
- <data-source>
- <driver value="org.hsqldb.jdbcDriver"/>
- <url value="jdbc:hsqldb:mem:java8"/>
- <connectionPool min="1" max="1"/>
- <login userName="sa"/>
- </data-source>
- </node>
-</domain>
http://git-wip-us.apache.org/repos/asf/cayenne/blob/4eb6a055/cayenne-java8/src/test/resources/java8.map.xml
----------------------------------------------------------------------
diff --git a/cayenne-java8/src/test/resources/java8.map.xml b/cayenne-java8/src/test/resources/java8.map.xml
deleted file mode 100644
index 42f6e86..0000000
--- a/cayenne-java8/src/test/resources/java8.map.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<data-map xmlns="http://cayenne.apache.org/schema/10/modelMap"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://cayenne.apache.org/schema/10/modelMap http://cayenne.apache.org/schema/10/modelMap.xsd"
- project-version="10">
- <property name="defaultPackage" value="org.apache.cayenne.java8.db"/>
- <db-entity name="LOCAL_DATETIME_TEST">
- <db-attribute name="ID" type="INTEGER" isPrimaryKey="true" isMandatory="true"/>
- <db-attribute name="Timestamp" type="TIMESTAMP"/>
- </db-entity>
- <db-entity name="LOCAL_DATE_TEST">
- <db-attribute name="Date" type="DATE"/>
- <db-attribute name="ID" type="INTEGER" isPrimaryKey="true" isMandatory="true"/>
- </db-entity>
- <db-entity name="LOCAL_TIME_TEST">
- <db-attribute name="ID" type="INTEGER" isPrimaryKey="true" isMandatory="true"/>
- <db-attribute name="Time" type="TIME"/>
- </db-entity>
- <obj-entity name="LocalDateTest" className="org.apache.cayenne.java8.db.LocalDateTestEntity" dbEntityName="LOCAL_DATE_TEST">
- <obj-attribute name="date" type="java.time.LocalDate" db-attribute-path="Date"/>
- </obj-entity>
- <obj-entity name="LocalDateTimeTest" className="org.apache.cayenne.java8.db.LocalDateTimeTestEntity" dbEntityName="LOCAL_DATETIME_TEST">
- <obj-attribute name="timestamp" type="java.time.LocalDateTime" db-attribute-path="Timestamp"/>
- </obj-entity>
- <obj-entity name="LocalTimeTest" className="org.apache.cayenne.java8.db.LocalTimeTestEntity" dbEntityName="LOCAL_TIME_TEST">
- <obj-attribute name="time" type="java.time.LocalTime" db-attribute-path="Time"/>
- </obj-entity>
-</data-map>
http://git-wip-us.apache.org/repos/asf/cayenne/blob/4eb6a055/cayenne-server/src/main/java/org/apache/cayenne/access/types/LocalDateTimeValueType.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/main/java/org/apache/cayenne/access/types/LocalDateTimeValueType.java b/cayenne-server/src/main/java/org/apache/cayenne/access/types/LocalDateTimeValueType.java
new file mode 100644
index 0000000..be9ad11
--- /dev/null
+++ b/cayenne-server/src/main/java/org/apache/cayenne/access/types/LocalDateTimeValueType.java
@@ -0,0 +1,54 @@
+/*****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ ****************************************************************/
+
+package org.apache.cayenne.access.types;
+
+import java.sql.Timestamp;
+import java.time.LocalDateTime;
+
+/**
+ * @since 4.0
+ */
+public class LocalDateTimeValueType implements ValueObjectType<LocalDateTime, Timestamp> {
+
+ @Override
+ public Class<Timestamp> getTargetType() {
+ return Timestamp.class;
+ }
+
+ @Override
+ public Class<LocalDateTime> getValueType() {
+ return LocalDateTime.class;
+ }
+
+ @Override
+ public LocalDateTime toJavaObject(Timestamp value) {
+ return value.toLocalDateTime();
+ }
+
+ @Override
+ public Timestamp fromJavaObject(LocalDateTime object) {
+ return Timestamp.valueOf(object);
+ }
+
+ @Override
+ public String toCacheKey(LocalDateTime object) {
+ return object.toString();
+ }
+}
http://git-wip-us.apache.org/repos/asf/cayenne/blob/4eb6a055/cayenne-server/src/main/java/org/apache/cayenne/access/types/LocalDateValueType.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/main/java/org/apache/cayenne/access/types/LocalDateValueType.java b/cayenne-server/src/main/java/org/apache/cayenne/access/types/LocalDateValueType.java
new file mode 100644
index 0000000..70fb8cb
--- /dev/null
+++ b/cayenne-server/src/main/java/org/apache/cayenne/access/types/LocalDateValueType.java
@@ -0,0 +1,54 @@
+/*****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ ****************************************************************/
+
+package org.apache.cayenne.access.types;
+
+import java.sql.Date;
+import java.time.LocalDate;
+
+/**
+ * @since 4.0
+ */
+public class LocalDateValueType implements ValueObjectType<LocalDate, Date> {
+
+ @Override
+ public Class<Date> getTargetType() {
+ return Date.class;
+ }
+
+ @Override
+ public Class<LocalDate> getValueType() {
+ return LocalDate.class;
+ }
+
+ @Override
+ public LocalDate toJavaObject(Date value) {
+ return value.toLocalDate();
+ }
+
+ @Override
+ public Date fromJavaObject(LocalDate object) {
+ return Date.valueOf(object);
+ }
+
+ @Override
+ public String toCacheKey(LocalDate object) {
+ return object.toString();
+ }
+}
http://git-wip-us.apache.org/repos/asf/cayenne/blob/4eb6a055/cayenne-server/src/main/java/org/apache/cayenne/access/types/LocalTimeValueType.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/main/java/org/apache/cayenne/access/types/LocalTimeValueType.java b/cayenne-server/src/main/java/org/apache/cayenne/access/types/LocalTimeValueType.java
new file mode 100644
index 0000000..5d787bd
--- /dev/null
+++ b/cayenne-server/src/main/java/org/apache/cayenne/access/types/LocalTimeValueType.java
@@ -0,0 +1,54 @@
+/*****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ ****************************************************************/
+
+package org.apache.cayenne.access.types;
+
+import java.sql.Time;
+import java.time.LocalTime;
+
+/**
+ * @since 4.0
+ */
+public class LocalTimeValueType implements ValueObjectType<LocalTime, Time> {
+
+ @Override
+ public Class<Time> getTargetType() {
+ return Time.class;
+ }
+
+ @Override
+ public Class<LocalTime> getValueType() {
+ return LocalTime.class;
+ }
+
+ @Override
+ public LocalTime toJavaObject(Time value) {
+ return value.toLocalTime();
+ }
+
+ @Override
+ public Time fromJavaObject(LocalTime object) {
+ return Time.valueOf(object);
+ }
+
+ @Override
+ public String toCacheKey(LocalTime object) {
+ return object.toString();
+ }
+}
http://git-wip-us.apache.org/repos/asf/cayenne/blob/4eb6a055/cayenne-server/src/main/java/org/apache/cayenne/configuration/server/ServerModule.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/main/java/org/apache/cayenne/configuration/server/ServerModule.java b/cayenne-server/src/main/java/org/apache/cayenne/configuration/server/ServerModule.java
index 49018ef..1b8c76b 100644
--- a/cayenne-server/src/main/java/org/apache/cayenne/configuration/server/ServerModule.java
+++ b/cayenne-server/src/main/java/org/apache/cayenne/configuration/server/ServerModule.java
@@ -48,6 +48,9 @@ import org.apache.cayenne.access.types.ExtendedType;
import org.apache.cayenne.access.types.ExtendedTypeFactory;
import org.apache.cayenne.access.types.FloatType;
import org.apache.cayenne.access.types.IntegerType;
+import org.apache.cayenne.access.types.LocalDateTimeValueType;
+import org.apache.cayenne.access.types.LocalDateValueType;
+import org.apache.cayenne.access.types.LocalTimeValueType;
import org.apache.cayenne.access.types.LongType;
import org.apache.cayenne.access.types.ShortType;
import org.apache.cayenne.access.types.TimeType;
@@ -334,7 +337,11 @@ public class ServerModule implements Module {
// Custom ValueObjects types contribution
contributeValueObjectTypes(binder)
.add(BigIntegerValueType.class)
- .add(UUIDValueType.class);
+ .add(UUIDValueType.class)
+ .add(LocalDateValueType.class)
+ .add(LocalTimeValueType.class)
+ .add(LocalDateTimeValueType.class);
+
binder.bind(ValueObjectTypeRegistry.class).to(DefaultValueObjectTypeRegistry.class);
// configure explicit configurations
http://git-wip-us.apache.org/repos/asf/cayenne/blob/4eb6a055/cayenne-server/src/test/java/org/apache/cayenne/access/types/Java8TimeIT.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/access/types/Java8TimeIT.java b/cayenne-server/src/test/java/org/apache/cayenne/access/types/Java8TimeIT.java
new file mode 100644
index 0000000..1f3d393
--- /dev/null
+++ b/cayenne-server/src/test/java/org/apache/cayenne/access/types/Java8TimeIT.java
@@ -0,0 +1,139 @@
+/*****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ ****************************************************************/
+
+package org.apache.cayenne.access.types;
+
+import org.apache.cayenne.access.DataContext;
+import org.apache.cayenne.di.Inject;
+import org.apache.cayenne.testdo.java8.LocalDateTestEntity;
+import org.apache.cayenne.testdo.java8.LocalDateTimeTestEntity;
+import org.apache.cayenne.testdo.java8.LocalTimeTestEntity;
+import org.apache.cayenne.query.ObjectSelect;
+import org.apache.cayenne.test.jdbc.DBHelper;
+import org.apache.cayenne.unit.di.server.CayenneProjects;
+import org.apache.cayenne.unit.di.server.ServerCase;
+import org.apache.cayenne.unit.di.server.UseServerRuntime;
+import org.junit.Before;
+import org.junit.Test;
+
+import java.sql.SQLException;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.time.LocalTime;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
+@UseServerRuntime(CayenneProjects.JAVA8)
+public class Java8TimeIT extends ServerCase {
+
+ @Inject
+ private DataContext context;
+
+ @Inject
+ private DBHelper dbHelper;
+
+ @Before
+ public void before() throws SQLException {
+ dbHelper.deleteAll("LOCAL_DATE_TEST");
+ dbHelper.deleteAll("LOCAL_DATETIME_TEST");
+ dbHelper.deleteAll("LOCAL_TIME_TEST");
+ }
+
+ @Test
+ public void testJava8LocalDate_Null() {
+ LocalDateTestEntity localDateTestEntity = context.newObject(LocalDateTestEntity.class);
+ localDateTestEntity.setDate(null);
+
+ context.commitChanges();
+
+ LocalDateTestEntity testRead = ObjectSelect.query(LocalDateTestEntity.class).selectOne(context);
+
+ assertNull(testRead.getDate());
+ }
+
+ @Test
+ public void testJava8LocalDate() {
+ LocalDateTestEntity localDateTestEntity = context.newObject(LocalDateTestEntity.class);
+ LocalDate localDate = LocalDate.now();
+ localDateTestEntity.setDate(localDate);
+
+ context.commitChanges();
+
+ LocalDateTestEntity testRead = ObjectSelect.query(LocalDateTestEntity.class).selectOne(context);
+
+ assertNotNull(testRead.getDate());
+ assertEquals(LocalDate.class, testRead.getDate().getClass());
+ assertEquals(localDate, testRead.getDate());
+ }
+
+ @Test
+ public void testJava8LocalTime() {
+ LocalTimeTestEntity localTimeTestEntity = context.newObject(LocalTimeTestEntity.class);
+ LocalTime localTime = LocalTime.now();
+ localTimeTestEntity.setTime(localTime);
+
+ context.commitChanges();
+
+ LocalTimeTestEntity testRead = ObjectSelect.query(LocalTimeTestEntity.class).selectOne(context);
+
+ assertNotNull(testRead.getTime());
+ assertEquals(LocalTime.class, testRead.getTime().getClass());
+ assertEquals(localTime.toSecondOfDay(), testRead.getTime().toSecondOfDay());
+
+ }
+
+ @Test
+ public void testJava8LocalDateTime() {
+ LocalDateTimeTestEntity localDateTimeTestEntity = context.newObject(LocalDateTimeTestEntity.class);
+ LocalDateTime localDateTime = LocalDateTime.now();
+ localDateTimeTestEntity.setTimestamp(localDateTime);
+
+ context.commitChanges();
+
+ LocalDateTimeTestEntity testRead = ObjectSelect.query(LocalDateTimeTestEntity.class).selectOne(context);
+
+ assertNotNull(testRead.getTimestamp());
+ assertEquals(LocalDateTime.class, testRead.getTimestamp().getClass());
+ assertEquals(localDateTime, testRead.getTimestamp());
+
+ }
+
+ @Test
+ public void columnSelectWithJava8Type() {
+ LocalDateTime localDateTime = LocalDateTime.now();
+
+ LocalDateTimeTestEntity localDateTimeTestEntity = context.newObject(LocalDateTimeTestEntity.class);
+ localDateTimeTestEntity.setTimestamp(localDateTime);
+
+ context.commitChanges();
+
+ LocalDateTime value = ObjectSelect.query(LocalDateTimeTestEntity.class)
+ .column(LocalDateTimeTestEntity.TIMESTAMP)
+ .selectOne(context);
+ assertEquals(localDateTime, value);
+
+ LocalDateTime value2 = ObjectSelect.query(LocalDateTimeTestEntity.class)
+ .min(LocalDateTimeTestEntity.TIMESTAMP)
+ .selectOne(context);
+ assertEquals(localDateTime, value2);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/cayenne/blob/4eb6a055/cayenne-server/src/test/java/org/apache/cayenne/testdo/java8/LocalDateTestEntity.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/testdo/java8/LocalDateTestEntity.java b/cayenne-server/src/test/java/org/apache/cayenne/testdo/java8/LocalDateTestEntity.java
new file mode 100644
index 0000000..32ffa9e
--- /dev/null
+++ b/cayenne-server/src/test/java/org/apache/cayenne/testdo/java8/LocalDateTestEntity.java
@@ -0,0 +1,27 @@
+/*****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ ****************************************************************/
+package org.apache.cayenne.testdo.java8;
+
+import org.apache.cayenne.testdo.java8.auto._LocalDateTestEntity;
+
+public class LocalDateTestEntity extends _LocalDateTestEntity {
+
+ private static final long serialVersionUID = 1L;
+
+}
http://git-wip-us.apache.org/repos/asf/cayenne/blob/4eb6a055/cayenne-server/src/test/java/org/apache/cayenne/testdo/java8/LocalDateTimeTestEntity.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/testdo/java8/LocalDateTimeTestEntity.java b/cayenne-server/src/test/java/org/apache/cayenne/testdo/java8/LocalDateTimeTestEntity.java
new file mode 100644
index 0000000..be4fffa
--- /dev/null
+++ b/cayenne-server/src/test/java/org/apache/cayenne/testdo/java8/LocalDateTimeTestEntity.java
@@ -0,0 +1,27 @@
+/*****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ ****************************************************************/
+package org.apache.cayenne.testdo.java8;
+
+import org.apache.cayenne.testdo.java8.auto._LocalDateTimeTestEntity;
+
+public class LocalDateTimeTestEntity extends _LocalDateTimeTestEntity {
+
+ private static final long serialVersionUID = 1L;
+
+}
http://git-wip-us.apache.org/repos/asf/cayenne/blob/4eb6a055/cayenne-server/src/test/java/org/apache/cayenne/testdo/java8/LocalTimeTestEntity.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/testdo/java8/LocalTimeTestEntity.java b/cayenne-server/src/test/java/org/apache/cayenne/testdo/java8/LocalTimeTestEntity.java
new file mode 100644
index 0000000..a6e1820
--- /dev/null
+++ b/cayenne-server/src/test/java/org/apache/cayenne/testdo/java8/LocalTimeTestEntity.java
@@ -0,0 +1,27 @@
+/*****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ ****************************************************************/
+package org.apache.cayenne.testdo.java8;
+
+import org.apache.cayenne.testdo.java8.auto._LocalTimeTestEntity;
+
+public class LocalTimeTestEntity extends _LocalTimeTestEntity {
+
+ private static final long serialVersionUID = 1L;
+
+}
http://git-wip-us.apache.org/repos/asf/cayenne/blob/4eb6a055/cayenne-server/src/test/java/org/apache/cayenne/testdo/java8/auto/_LocalDateTestEntity.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/testdo/java8/auto/_LocalDateTestEntity.java b/cayenne-server/src/test/java/org/apache/cayenne/testdo/java8/auto/_LocalDateTestEntity.java
new file mode 100644
index 0000000..ae69eeb
--- /dev/null
+++ b/cayenne-server/src/test/java/org/apache/cayenne/testdo/java8/auto/_LocalDateTestEntity.java
@@ -0,0 +1,87 @@
+package org.apache.cayenne.testdo.java8.auto;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.time.LocalDate;
+
+import org.apache.cayenne.BaseDataObject;
+import org.apache.cayenne.exp.Property;
+
+/**
+ * Class _LocalDateTestEntity was generated by Cayenne.
+ * It is probably a good idea to avoid changing this class manually,
+ * since it may be overwritten next time code is regenerated.
+ * If you need to make any customizations, please use subclass.
+ */
+public abstract class _LocalDateTestEntity extends BaseDataObject {
+
+ private static final long serialVersionUID = 1L;
+
+ public static final String ID_PK_COLUMN = "ID";
+
+ public static final Property<LocalDate> DATE = Property.create("date", LocalDate.class);
+
+ protected LocalDate date;
+
+
+ public void setDate(LocalDate date) {
+ beforePropertyWrite("date", this.date, date);
+ this.date = date;
+ }
+
+ public LocalDate getDate() {
+ beforePropertyRead("date");
+ return date;
+ }
+
+ @Override
+ public Object readPropertyDirectly(String propName) {
+ if(propName == null) {
+ throw new IllegalArgumentException();
+ }
+
+ switch(propName) {
+ case "date":
+ return this.date;
+ default:
+ return super.readPropertyDirectly(propName);
+ }
+ }
+
+ @Override
+ public void writePropertyDirectly(String propName, Object val) {
+ if(propName == null) {
+ throw new IllegalArgumentException();
+ }
+
+ switch (propName) {
+ case "date":
+ this.date = (LocalDate)val;
+ break;
+ default:
+ super.writePropertyDirectly(propName, val);
+ }
+ }
+
+ private void writeObject(ObjectOutputStream out) throws IOException {
+ writeSerialized(out);
+ }
+
+ private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
+ readSerialized(in);
+ }
+
+ @Override
+ protected void writeState(ObjectOutputStream out) throws IOException {
+ super.writeState(out);
+ out.writeObject(date);
+ }
+
+ @Override
+ protected void readState(ObjectInputStream in) throws IOException, ClassNotFoundException {
+ super.readState(in);
+ date = (LocalDate)in.readObject();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/cayenne/blob/4eb6a055/cayenne-server/src/test/java/org/apache/cayenne/testdo/java8/auto/_LocalDateTimeTestEntity.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/testdo/java8/auto/_LocalDateTimeTestEntity.java b/cayenne-server/src/test/java/org/apache/cayenne/testdo/java8/auto/_LocalDateTimeTestEntity.java
new file mode 100644
index 0000000..98dcc4d
--- /dev/null
+++ b/cayenne-server/src/test/java/org/apache/cayenne/testdo/java8/auto/_LocalDateTimeTestEntity.java
@@ -0,0 +1,87 @@
+package org.apache.cayenne.testdo.java8.auto;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.time.LocalDateTime;
+
+import org.apache.cayenne.BaseDataObject;
+import org.apache.cayenne.exp.Property;
+
+/**
+ * Class _LocalDateTimeTestEntity was generated by Cayenne.
+ * It is probably a good idea to avoid changing this class manually,
+ * since it may be overwritten next time code is regenerated.
+ * If you need to make any customizations, please use subclass.
+ */
+public abstract class _LocalDateTimeTestEntity extends BaseDataObject {
+
+ private static final long serialVersionUID = 1L;
+
+ public static final String ID_PK_COLUMN = "ID";
+
+ public static final Property<LocalDateTime> TIMESTAMP = Property.create("timestamp", LocalDateTime.class);
+
+ protected LocalDateTime timestamp;
+
+
+ public void setTimestamp(LocalDateTime timestamp) {
+ beforePropertyWrite("timestamp", this.timestamp, timestamp);
+ this.timestamp = timestamp;
+ }
+
+ public LocalDateTime getTimestamp() {
+ beforePropertyRead("timestamp");
+ return timestamp;
+ }
+
+ @Override
+ public Object readPropertyDirectly(String propName) {
+ if(propName == null) {
+ throw new IllegalArgumentException();
+ }
+
+ switch(propName) {
+ case "timestamp":
+ return this.timestamp;
+ default:
+ return super.readPropertyDirectly(propName);
+ }
+ }
+
+ @Override
+ public void writePropertyDirectly(String propName, Object val) {
+ if(propName == null) {
+ throw new IllegalArgumentException();
+ }
+
+ switch (propName) {
+ case "timestamp":
+ this.timestamp = (LocalDateTime)val;
+ break;
+ default:
+ super.writePropertyDirectly(propName, val);
+ }
+ }
+
+ private void writeObject(ObjectOutputStream out) throws IOException {
+ writeSerialized(out);
+ }
+
+ private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
+ readSerialized(in);
+ }
+
+ @Override
+ protected void writeState(ObjectOutputStream out) throws IOException {
+ super.writeState(out);
+ out.writeObject(timestamp);
+ }
+
+ @Override
+ protected void readState(ObjectInputStream in) throws IOException, ClassNotFoundException {
+ super.readState(in);
+ timestamp = (LocalDateTime)in.readObject();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/cayenne/blob/4eb6a055/cayenne-server/src/test/java/org/apache/cayenne/testdo/java8/auto/_LocalTimeTestEntity.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/testdo/java8/auto/_LocalTimeTestEntity.java b/cayenne-server/src/test/java/org/apache/cayenne/testdo/java8/auto/_LocalTimeTestEntity.java
new file mode 100644
index 0000000..63fb8a4
--- /dev/null
+++ b/cayenne-server/src/test/java/org/apache/cayenne/testdo/java8/auto/_LocalTimeTestEntity.java
@@ -0,0 +1,87 @@
+package org.apache.cayenne.testdo.java8.auto;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.time.LocalTime;
+
+import org.apache.cayenne.BaseDataObject;
+import org.apache.cayenne.exp.Property;
+
+/**
+ * Class _LocalTimeTestEntity was generated by Cayenne.
+ * It is probably a good idea to avoid changing this class manually,
+ * since it may be overwritten next time code is regenerated.
+ * If you need to make any customizations, please use subclass.
+ */
+public abstract class _LocalTimeTestEntity extends BaseDataObject {
+
+ private static final long serialVersionUID = 1L;
+
+ public static final String ID_PK_COLUMN = "ID";
+
+ public static final Property<LocalTime> TIME = Property.create("time", LocalTime.class);
+
+ protected LocalTime time;
+
+
+ public void setTime(LocalTime time) {
+ beforePropertyWrite("time", this.time, time);
+ this.time = time;
+ }
+
+ public LocalTime getTime() {
+ beforePropertyRead("time");
+ return time;
+ }
+
+ @Override
+ public Object readPropertyDirectly(String propName) {
+ if(propName == null) {
+ throw new IllegalArgumentException();
+ }
+
+ switch(propName) {
+ case "time":
+ return this.time;
+ default:
+ return super.readPropertyDirectly(propName);
+ }
+ }
+
+ @Override
+ public void writePropertyDirectly(String propName, Object val) {
+ if(propName == null) {
+ throw new IllegalArgumentException();
+ }
+
+ switch (propName) {
+ case "time":
+ this.time = (LocalTime)val;
+ break;
+ default:
+ super.writePropertyDirectly(propName, val);
+ }
+ }
+
+ private void writeObject(ObjectOutputStream out) throws IOException {
+ writeSerialized(out);
+ }
+
+ private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
+ readSerialized(in);
+ }
+
+ @Override
+ protected void writeState(ObjectOutputStream out) throws IOException {
+ super.writeState(out);
+ out.writeObject(time);
+ }
+
+ @Override
+ protected void readState(ObjectInputStream in) throws IOException, ClassNotFoundException {
+ super.readState(in);
+ time = (LocalTime)in.readObject();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/cayenne/blob/4eb6a055/cayenne-server/src/test/java/org/apache/cayenne/unit/di/server/CayenneProjects.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/unit/di/server/CayenneProjects.java b/cayenne-server/src/test/java/org/apache/cayenne/unit/di/server/CayenneProjects.java
index 10615ab..857027b 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/unit/di/server/CayenneProjects.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/unit/di/server/CayenneProjects.java
@@ -81,4 +81,5 @@ public class CayenneProjects {
public static final String CUSTOM_NAME_PROJECT = "custom-name-file.xml";
public static final String WEIGHTED_SORT_PROJECT = "cayenne-weighted-sort.xml";
public static final String HYBRID_DATA_OBJECT_PROJECT = "cayenne-hybrid-data-object.xml";
+ public static final String JAVA8 = "cayenne-java8.xml";
}
http://git-wip-us.apache.org/repos/asf/cayenne/blob/4eb6a055/cayenne-server/src/test/java/org/apache/cayenne/unit/di/server/SchemaBuilder.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/unit/di/server/SchemaBuilder.java b/cayenne-server/src/test/java/org/apache/cayenne/unit/di/server/SchemaBuilder.java
index f217052..aa1669c 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/unit/di/server/SchemaBuilder.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/unit/di/server/SchemaBuilder.java
@@ -82,7 +82,7 @@ public class SchemaBuilder {
"table-primitives.map.xml", "generic.map.xml", "map-db1.map.xml", "map-db2.map.xml", "embeddable.map.xml",
"qualified.map.xml", "quoted-identifiers.map.xml", "inheritance-single-table1.map.xml",
"inheritance-vertical.map.xml", "oneway-rels.map.xml", "unsupported-distinct-types.map.xml",
- "array-type.map.xml", "cay-2032.map.xml", "weighted-sort.map.xml", "hybrid-data-object.map.xml" };
+ "array-type.map.xml", "cay-2032.map.xml", "weighted-sort.map.xml", "hybrid-data-object.map.xml", "java8.map.xml" };
// hardcoded dependent entities that should be excluded
// if LOBs are not supported
http://git-wip-us.apache.org/repos/asf/cayenne/blob/4eb6a055/cayenne-server/src/test/java/org/apache/cayenne/unit/di/server/ServerCaseModule.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/unit/di/server/ServerCaseModule.java b/cayenne-server/src/test/java/org/apache/cayenne/unit/di/server/ServerCaseModule.java
index 3fa74dc..560ce3b 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/unit/di/server/ServerCaseModule.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/unit/di/server/ServerCaseModule.java
@@ -36,6 +36,9 @@ import org.apache.cayenne.access.types.DefaultValueObjectTypeRegistry;
import org.apache.cayenne.access.types.DoubleType;
import org.apache.cayenne.access.types.FloatType;
import org.apache.cayenne.access.types.IntegerType;
+import org.apache.cayenne.access.types.LocalDateTimeValueType;
+import org.apache.cayenne.access.types.LocalDateValueType;
+import org.apache.cayenne.access.types.LocalTimeValueType;
import org.apache.cayenne.access.types.LongType;
import org.apache.cayenne.access.types.ShortType;
import org.apache.cayenne.access.types.TimeType;
@@ -173,7 +176,10 @@ public class ServerCaseModule implements Module {
ServerModule.contributeTypeFactories(binder);
ServerModule.contributeValueObjectTypes(binder)
.add(BigIntegerValueType.class)
- .add(UUIDValueType.class);
+ .add(UUIDValueType.class)
+ .add(LocalDateValueType.class)
+ .add(LocalTimeValueType.class)
+ .add(LocalDateTimeValueType.class);
binder.bind(ValueObjectTypeRegistry.class).to(DefaultValueObjectTypeRegistry.class);
binder.bind(SchemaBuilder.class).to(SchemaBuilder.class);
http://git-wip-us.apache.org/repos/asf/cayenne/blob/4eb6a055/cayenne-server/src/test/resources/cayenne-java8.xml
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/resources/cayenne-java8.xml b/cayenne-server/src/test/resources/cayenne-java8.xml
new file mode 100644
index 0000000..b0476f4
--- /dev/null
+++ b/cayenne-server/src/test/resources/cayenne-java8.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<domain xmlns="http://cayenne.apache.org/schema/10/domain"
+ project-version="10">
+ <map name="java8"/>
+</domain>
http://git-wip-us.apache.org/repos/asf/cayenne/blob/4eb6a055/cayenne-server/src/test/resources/java8.map.xml
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/resources/java8.map.xml b/cayenne-server/src/test/resources/java8.map.xml
new file mode 100644
index 0000000..9018dfd
--- /dev/null
+++ b/cayenne-server/src/test/resources/java8.map.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<data-map xmlns="http://cayenne.apache.org/schema/10/modelMap"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://cayenne.apache.org/schema/10/modelMap http://cayenne.apache.org/schema/10/modelMap.xsd"
+ project-version="10">
+ <property name="defaultPackage" value="org.apache.cayenne.testdo.java8"/>
+ <db-entity name="LOCAL_DATETIME_TEST">
+ <db-attribute name="ID" type="INTEGER" isPrimaryKey="true" isMandatory="true"/>
+ <db-attribute name="Timestamp" type="TIMESTAMP"/>
+ </db-entity>
+ <db-entity name="LOCAL_DATE_TEST">
+ <db-attribute name="Date" type="DATE"/>
+ <db-attribute name="ID" type="INTEGER" isPrimaryKey="true" isMandatory="true"/>
+ </db-entity>
+ <db-entity name="LOCAL_TIME_TEST">
+ <db-attribute name="ID" type="INTEGER" isPrimaryKey="true" isMandatory="true"/>
+ <db-attribute name="Time" type="TIME"/>
+ </db-entity>
+ <obj-entity name="LocalDateTest" className="org.apache.cayenne.testdo.java8.LocalDateTestEntity" dbEntityName="LOCAL_DATE_TEST">
+ <obj-attribute name="date" type="java.time.LocalDate" db-attribute-path="Date"/>
+ </obj-entity>
+ <obj-entity name="LocalDateTimeTest" className="org.apache.cayenne.testdo.java8.LocalDateTimeTestEntity" dbEntityName="LOCAL_DATETIME_TEST">
+ <obj-attribute name="timestamp" type="java.time.LocalDateTime" db-attribute-path="Timestamp"/>
+ </obj-entity>
+ <obj-entity name="LocalTimeTest" className="org.apache.cayenne.testdo.java8.LocalTimeTestEntity" dbEntityName="LOCAL_TIME_TEST">
+ <obj-attribute name="time" type="java.time.LocalTime" db-attribute-path="Time"/>
+ </obj-entity>
+</data-map>