cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ntimof...@apache.org
Subject [1/3] cayenne git commit: CAY-2328 Update tutorial code
Date Thu, 08 Jun 2017 08:23:48 GMT
Repository: cayenne
Updated Branches:
  refs/heads/master d8ffcdf07 -> 1b91a9053


CAY-2328 Update tutorial code


Project: http://git-wip-us.apache.org/repos/asf/cayenne/repo
Commit: http://git-wip-us.apache.org/repos/asf/cayenne/commit/347e504c
Tree: http://git-wip-us.apache.org/repos/asf/cayenne/tree/347e504c
Diff: http://git-wip-us.apache.org/repos/asf/cayenne/diff/347e504c

Branch: refs/heads/master
Commit: 347e504ca40e07fceb466cc87bb2e01c04ac4d1d
Parents: c299812
Author: Anton Dreka <drekoas@gmail.com>
Authored: Thu Jun 8 09:36:46 2017 +0300
Committer: Anton Dreka <drekoas@gmail.com>
Committed: Thu Jun 8 09:36:46 2017 +0300

----------------------------------------------------------------------
 .../getting-started/src/docbkx/delete.xml       |  3 +-
 .../getting-started/src/docbkx/select-query.xml |  7 ++---
 tutorials/tutorial-rop-client/pom.xml           |  7 +++++
 .../persistent/client/auto/_Artist.java         | 14 ++++-----
 tutorials/tutorial-rop-server/pom.xml           |  7 +++++
 .../cayenne/tutorial/persistent/Artist.java     | 20 ++++++-------
 .../tutorial/persistent/auto/_Artist.java       | 10 +++----
 .../persistent/client/auto/_Artist.java         | 10 +++----
 .../src/main/resources/datamap.map.xml          |  2 +-
 tutorials/tutorial/pom.xml                      | 29 +++++++++++++-----
 .../java/org/apache/cayenne/tutorial/Main.java  | 31 +++++++-------------
 .../cayenne/tutorial/persistent/Artist.java     | 20 ++++++-------
 .../tutorial/persistent/auto/_Artist.java       | 10 +++----
 .../tutorial/src/main/resources/datamap.map.xml |  2 +-
 tutorials/tutorial/src/main/webapp/detail.jsp   |  4 ++-
 tutorials/tutorial/src/main/webapp/index.jsp    | 10 +++----
 16 files changed, 99 insertions(+), 87 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cayenne/blob/347e504c/docs/docbook/getting-started/src/docbkx/delete.xml
----------------------------------------------------------------------
diff --git a/docs/docbook/getting-started/src/docbkx/delete.xml b/docs/docbook/getting-started/src/docbkx/delete.xml
index fd16e8d..0da6af3 100644
--- a/docs/docbook/getting-started/src/docbkx/delete.xml
+++ b/docs/docbook/getting-started/src/docbkx/delete.xml
@@ -52,7 +52,8 @@
             more common way in Cayenne (or ORM in general) is to get a hold of the object
first, and
             then delete it via the context. Let's use utility class Cayenne to find an
             artist:</para>
-        <programlisting language="java">Artist picasso = ObjectSelect.query(Artist.class).where(Artist.NAME.eq("Pablo
Picasso")).selectOne(context);</programlisting>
+        <programlisting language="java">Artist picasso = ObjectSelect.query(Artist.class)
+            .where(Artist.NAME.eq("Pablo Picasso")).selectOne(context);</programlisting>
         <para>Now let's delete the artist:</para>
         <programlisting language="java">if (picasso != null) {
     context.deleteObject(picasso);

http://git-wip-us.apache.org/repos/asf/cayenne/blob/347e504c/docs/docbook/getting-started/src/docbkx/select-query.xml
----------------------------------------------------------------------
diff --git a/docs/docbook/getting-started/src/docbkx/select-query.xml b/docs/docbook/getting-started/src/docbkx/select-query.xml
index e97fed3..72ee254 100644
--- a/docs/docbook/getting-started/src/docbkx/select-query.xml
+++ b/docs/docbook/getting-started/src/docbkx/select-query.xml
@@ -50,11 +50,8 @@ INFO: === returned 1 row. - took 18 ms.</screen>
                     ago:</para>
             </listitem>
         </itemizedlist>
-        <programlisting language="java">Calendar c = new GregorianCalendar();
-c.set(c.get(Calendar.YEAR) - 100, 0, 1, 0, 0, 0);
-
-List&lt;Painting> paintings3 = ObjectSelect.query(Painting.class)
-        .where(Painting.ARTIST.dot(Artist.DATE_OF_BIRTH).lt(c.getTime()))
+        <programlisting language="java">List&lt;Painting> paintings3 = ObjectSelect.query(Painting.class)
+        .where(Painting.ARTIST.dot(Artist.DATE_OF_BIRTH).lt(LocalDate.of(1900,1,1)))
         .select(context); </programlisting>
         <screen>INFO: SELECT t0.GALLERY_ID, t0.NAME, t0.ARTIST_ID, t0.ID FROM PAINTING
t0 JOIN ARTIST t1 ON (t0.ARTIST_ID = t1.ID)
       WHERE t1.DATE_OF_BIRTH &lt; ? [bind: 1->DATE_OF_BIRTH:'1911-01-01 00:00:00.493']
- prepared in 7 ms.

http://git-wip-us.apache.org/repos/asf/cayenne/blob/347e504c/tutorials/tutorial-rop-client/pom.xml
----------------------------------------------------------------------
diff --git a/tutorials/tutorial-rop-client/pom.xml b/tutorials/tutorial-rop-client/pom.xml
index 6e1bd92..0c9992a 100644
--- a/tutorials/tutorial-rop-client/pom.xml
+++ b/tutorials/tutorial-rop-client/pom.xml
@@ -46,6 +46,13 @@
 					<skip>true</skip>
 				</configuration>
 			</plugin>
+			<plugin>
+				<artifactId>maven-compiler-plugin</artifactId>
+				<configuration>
+					<source>1.8</source>
+					<target>1.8</target>
+				</configuration>
+			</plugin>
 		</plugins>
 	</build>
 

http://git-wip-us.apache.org/repos/asf/cayenne/blob/347e504c/tutorials/tutorial-rop-client/src/main/java/org/apache/cayenne/tutorial/persistent/client/auto/_Artist.java
----------------------------------------------------------------------
diff --git a/tutorials/tutorial-rop-client/src/main/java/org/apache/cayenne/tutorial/persistent/client/auto/_Artist.java
b/tutorials/tutorial-rop-client/src/main/java/org/apache/cayenne/tutorial/persistent/client/auto/_Artist.java
index 0856981..a558c2b 100644
--- a/tutorials/tutorial-rop-client/src/main/java/org/apache/cayenne/tutorial/persistent/client/auto/_Artist.java
+++ b/tutorials/tutorial-rop-client/src/main/java/org/apache/cayenne/tutorial/persistent/client/auto/_Artist.java
@@ -1,13 +1,13 @@
 package org.apache.cayenne.tutorial.persistent.client.auto;
 
-import java.util.Date;
-import java.util.List;
-
 import org.apache.cayenne.PersistentObject;
 import org.apache.cayenne.exp.Property;
 import org.apache.cayenne.tutorial.persistent.client.Painting;
 import org.apache.cayenne.util.PersistentObjectList;
 
+import java.time.LocalDate;
+import java.util.List;
+
 /**
  * A generated persistent class mapped as "Artist" Cayenne entity. It is a good idea to
  * avoid changing this class manually, since it will be overwritten next time code is
@@ -15,22 +15,22 @@ import org.apache.cayenne.util.PersistentObjectList;
  */
 public abstract class _Artist extends PersistentObject {
 
-    public static final Property<Date> DATE_OF_BIRTH = Property.create("dateOfBirth",
Date.class);
+    public static final Property<LocalDate> DATE_OF_BIRTH = Property.create("dateOfBirth",
LocalDate.class);
     public static final Property<String> NAME = Property.create("name", String.class);
     public static final Property<List<Painting>> PAINTINGS = Property.create("paintings",
List.class);
 
-    protected Date dateOfBirth;
+    protected LocalDate dateOfBirth;
     protected String name;
     protected List<Painting> paintings;
 
-    public Date getDateOfBirth() {
+    public LocalDate getDateOfBirth() {
         if(objectContext != null) {
             objectContext.prepareForAccess(this, "dateOfBirth", false);
         }
 
         return dateOfBirth;
     }
-    public void setDateOfBirth(Date dateOfBirth) {
+    public void setDateOfBirth(LocalDate dateOfBirth) {
         if(objectContext != null) {
             objectContext.prepareForAccess(this, "dateOfBirth", false);
         }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/347e504c/tutorials/tutorial-rop-server/pom.xml
----------------------------------------------------------------------
diff --git a/tutorials/tutorial-rop-server/pom.xml b/tutorials/tutorial-rop-server/pom.xml
index d4c397e..44537ce 100644
--- a/tutorials/tutorial-rop-server/pom.xml
+++ b/tutorials/tutorial-rop-server/pom.xml
@@ -69,6 +69,13 @@
 					<skip>true</skip>
 				</configuration>
 			</plugin>
+			<plugin>
+				<artifactId>maven-compiler-plugin</artifactId>
+				<configuration>
+					<source>1.8</source>
+					<target>1.8</target>
+				</configuration>
+			</plugin>
 		</plugins>
 	</build>
 

http://git-wip-us.apache.org/repos/asf/cayenne/blob/347e504c/tutorials/tutorial-rop-server/src/main/java/org/apache/cayenne/tutorial/persistent/Artist.java
----------------------------------------------------------------------
diff --git a/tutorials/tutorial-rop-server/src/main/java/org/apache/cayenne/tutorial/persistent/Artist.java
b/tutorials/tutorial-rop-server/src/main/java/org/apache/cayenne/tutorial/persistent/Artist.java
index 8846edc..318ceb0 100644
--- a/tutorials/tutorial-rop-server/src/main/java/org/apache/cayenne/tutorial/persistent/Artist.java
+++ b/tutorials/tutorial-rop-server/src/main/java/org/apache/cayenne/tutorial/persistent/Artist.java
@@ -18,9 +18,9 @@
  ****************************************************************/
 package org.apache.cayenne.tutorial.persistent;
 
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.Date;
+import java.time.LocalDate;
+import java.time.format.DateTimeFormatter;
+import java.time.format.DateTimeParseException;
 
 import org.apache.cayenne.tutorial.persistent.auto._Artist;
 
@@ -36,16 +36,14 @@ public class Artist extends _Artist {
 			setDateOfBirth(null);
 		} else {
 
-			Date date;
+			LocalDate date;
 			try {
-				date = new SimpleDateFormat(DEFAULT_DATE_FORMAT)
-						.parse(yearMonthDay);
-			} catch (ParseException e) {
-				throw new IllegalArgumentException(
-						"A date argument must be in format '"
-								+ DEFAULT_DATE_FORMAT + "': " + yearMonthDay);
+				DateTimeFormatter formatter = DateTimeFormatter.ofPattern(DEFAULT_DATE_FORMAT);
+				date = LocalDate.parse(yearMonthDay, formatter);
+			} catch (DateTimeParseException e) {
+				throw new IllegalArgumentException("A date argument must be in format '"
+						+ DEFAULT_DATE_FORMAT + "': " + yearMonthDay);
 			}
-
 			setDateOfBirth(date);
 		}
 	}

http://git-wip-us.apache.org/repos/asf/cayenne/blob/347e504c/tutorials/tutorial-rop-server/src/main/java/org/apache/cayenne/tutorial/persistent/auto/_Artist.java
----------------------------------------------------------------------
diff --git a/tutorials/tutorial-rop-server/src/main/java/org/apache/cayenne/tutorial/persistent/auto/_Artist.java
b/tutorials/tutorial-rop-server/src/main/java/org/apache/cayenne/tutorial/persistent/auto/_Artist.java
index 93797c8..147f9f7 100644
--- a/tutorials/tutorial-rop-server/src/main/java/org/apache/cayenne/tutorial/persistent/auto/_Artist.java
+++ b/tutorials/tutorial-rop-server/src/main/java/org/apache/cayenne/tutorial/persistent/auto/_Artist.java
@@ -1,6 +1,6 @@
 package org.apache.cayenne.tutorial.persistent.auto;
 
-import java.util.Date;
+import java.time.LocalDate;
 import java.util.List;
 
 import org.apache.cayenne.CayenneDataObject;
@@ -19,15 +19,15 @@ public abstract class _Artist extends CayenneDataObject {
 
     public static final String ID_PK_COLUMN = "ID";
 
-    public static final Property<Date> DATE_OF_BIRTH = Property.create("dateOfBirth",
Date.class);
+    public static final Property<LocalDate> DATE_OF_BIRTH = Property.create("dateOfBirth",
LocalDate.class);
     public static final Property<String> NAME = Property.create("name", String.class);
     public static final Property<List<Painting>> PAINTINGS = Property.create("paintings",
List.class);
 
-    public void setDateOfBirth(Date dateOfBirth) {
+    public void setDateOfBirth(LocalDate dateOfBirth) {
         writeProperty("dateOfBirth", dateOfBirth);
     }
-    public Date getDateOfBirth() {
-        return (Date)readProperty("dateOfBirth");
+    public LocalDate getDateOfBirth() {
+        return (LocalDate)readProperty("dateOfBirth");
     }
 
     public void setName(String name) {

http://git-wip-us.apache.org/repos/asf/cayenne/blob/347e504c/tutorials/tutorial-rop-server/src/main/java/org/apache/cayenne/tutorial/persistent/client/auto/_Artist.java
----------------------------------------------------------------------
diff --git a/tutorials/tutorial-rop-server/src/main/java/org/apache/cayenne/tutorial/persistent/client/auto/_Artist.java
b/tutorials/tutorial-rop-server/src/main/java/org/apache/cayenne/tutorial/persistent/client/auto/_Artist.java
index 0856981..b478b8d 100644
--- a/tutorials/tutorial-rop-server/src/main/java/org/apache/cayenne/tutorial/persistent/client/auto/_Artist.java
+++ b/tutorials/tutorial-rop-server/src/main/java/org/apache/cayenne/tutorial/persistent/client/auto/_Artist.java
@@ -1,6 +1,6 @@
 package org.apache.cayenne.tutorial.persistent.client.auto;
 
-import java.util.Date;
+import java.time.LocalDate;
 import java.util.List;
 
 import org.apache.cayenne.PersistentObject;
@@ -15,22 +15,22 @@ import org.apache.cayenne.util.PersistentObjectList;
  */
 public abstract class _Artist extends PersistentObject {
 
-    public static final Property<Date> DATE_OF_BIRTH = Property.create("dateOfBirth",
Date.class);
+    public static final Property<LocalDate> DATE_OF_BIRTH = Property.create("dateOfBirth",
LocalDate.class);
     public static final Property<String> NAME = Property.create("name", String.class);
     public static final Property<List<Painting>> PAINTINGS = Property.create("paintings",
List.class);
 
-    protected Date dateOfBirth;
+    protected LocalDate dateOfBirth;
     protected String name;
     protected List<Painting> paintings;
 
-    public Date getDateOfBirth() {
+    public LocalDate getDateOfBirth() {
         if(objectContext != null) {
             objectContext.prepareForAccess(this, "dateOfBirth", false);
         }
 
         return dateOfBirth;
     }
-    public void setDateOfBirth(Date dateOfBirth) {
+    public void setDateOfBirth(LocalDate dateOfBirth) {
         if(objectContext != null) {
             objectContext.prepareForAccess(this, "dateOfBirth", false);
         }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/347e504c/tutorials/tutorial-rop-server/src/main/resources/datamap.map.xml
----------------------------------------------------------------------
diff --git a/tutorials/tutorial-rop-server/src/main/resources/datamap.map.xml b/tutorials/tutorial-rop-server/src/main/resources/datamap.map.xml
index 8edf4d2..e0a7e3f 100644
--- a/tutorials/tutorial-rop-server/src/main/resources/datamap.map.xml
+++ b/tutorials/tutorial-rop-server/src/main/resources/datamap.map.xml
@@ -22,7 +22,7 @@
 		<db-attribute name="NAME" type="VARCHAR" length="200"/>
 	</db-entity>
 	<obj-entity name="Artist" className="org.apache.cayenne.tutorial.persistent.Artist" clientClassName="org.apache.cayenne.tutorial.persistent.client.Artist"
dbEntityName="ARTIST">
-		<obj-attribute name="dateOfBirth" type="java.util.Date" db-attribute-path="DATE_OF_BIRTH"/>
+		<obj-attribute name="dateOfBirth" type="java.time.LocalDate" db-attribute-path="DATE_OF_BIRTH"/>
 		<obj-attribute name="name" type="java.lang.String" db-attribute-path="NAME"/>
 	</obj-entity>
 	<obj-entity name="Gallery" className="org.apache.cayenne.tutorial.persistent.Gallery"
clientClassName="org.apache.cayenne.tutorial.persistent.client.Gallery" dbEntityName="GALLERY">

http://git-wip-us.apache.org/repos/asf/cayenne/blob/347e504c/tutorials/tutorial/pom.xml
----------------------------------------------------------------------
diff --git a/tutorials/tutorial/pom.xml b/tutorials/tutorial/pom.xml
index 0a96393..5ac1ff0 100644
--- a/tutorials/tutorial/pom.xml
+++ b/tutorials/tutorial/pom.xml
@@ -31,6 +31,11 @@
 			<version>${project.version}</version>
 		</dependency>
 		<dependency>
+			<groupId>org.apache.cayenne</groupId>
+			<artifactId>cayenne-java8</artifactId>
+			<version>${project.version}</version>
+		</dependency>
+		<dependency>
 			<groupId>javax.servlet</groupId>
 			<artifactId>servlet-api</artifactId>
 		</dependency>
@@ -43,18 +48,26 @@
 
 	<build>
 		<plugins>
-			<plugin>
-				<groupId>org.mortbay.jetty</groupId>
-				<artifactId>maven-jetty-plugin</artifactId>
-				<version>6.1.22</version>
-			</plugin>
-			<plugin>
+            <plugin>
+                <groupId>org.eclipse.jetty</groupId>
+                <artifactId>jetty-maven-plugin</artifactId>
+                <version>9.3.19.v20170502</version>
+            </plugin>
+            <plugin>
 				<groupId>org.apache.maven.plugins</groupId>
-				<artifactId>maven-deploy-plugin</artifactId>
+				<artifactId>maven-compiler-plugin</artifactId>
 				<configuration>
-					<skip>true</skip>
+					<source>1.8</source>
+					<target>1.8</target>
 				</configuration>
 			</plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-deploy-plugin</artifactId>
+                <configuration>
+                    <skip>true</skip>
+                </configuration>
+            </plugin>
 		</plugins>
 	</build>
 

http://git-wip-us.apache.org/repos/asf/cayenne/blob/347e504c/tutorials/tutorial/src/main/java/org/apache/cayenne/tutorial/Main.java
----------------------------------------------------------------------
diff --git a/tutorials/tutorial/src/main/java/org/apache/cayenne/tutorial/Main.java b/tutorials/tutorial/src/main/java/org/apache/cayenne/tutorial/Main.java
index c1b8754..923c014 100644
--- a/tutorials/tutorial/src/main/java/org/apache/cayenne/tutorial/Main.java
+++ b/tutorials/tutorial/src/main/java/org/apache/cayenne/tutorial/Main.java
@@ -18,17 +18,12 @@
  ****************************************************************/
 package org.apache.cayenne.tutorial;
 
-import static org.apache.cayenne.exp.ExpressionFactory.exp;
-
-import java.util.Calendar;
-import java.util.GregorianCalendar;
+import java.time.LocalDate;
 import java.util.List;
 
-import org.apache.cayenne.Cayenne;
 import org.apache.cayenne.ObjectContext;
 import org.apache.cayenne.configuration.server.ServerRuntime;
-import org.apache.cayenne.exp.Expression;
-import org.apache.cayenne.query.SelectQuery;
+import org.apache.cayenne.query.ObjectSelect;
 import org.apache.cayenne.tutorial.persistent.Artist;
 import org.apache.cayenne.tutorial.persistent.Gallery;
 import org.apache.cayenne.tutorial.persistent.Painting;
@@ -80,26 +75,20 @@ public class Main {
 
     static void selectTutorial(ObjectContext context) {
         // SelectQuery examples
-        SelectQuery<Painting> select1 = SelectQuery.query(Painting.class, null);
-        List<Painting> paintings1 = context.select(select1);
-
-        Expression qualifier2 = Painting.NAME.likeIgnoreCase("gi%");
-        SelectQuery<Painting> select2 = SelectQuery.query(Painting.class, qualifier2);
-        List<Painting> paintings2 = context.select(select2);
+        List<Painting> paintings1 = ObjectSelect.query(Painting.class).select(context);
 
-        Calendar c = new GregorianCalendar();
-        c.set(c.get(Calendar.YEAR) - 100, 0, 1, 0, 0, 0);
+        List<Painting> paintings2 = ObjectSelect.query(Painting.class)
+                .where(Painting.NAME.likeIgnoreCase("gi%")).select(context);
 
-        Expression qualifier3 = exp("artist.dateOfBirth < $date", c.getTime());
-        SelectQuery<Painting> select3 = SelectQuery.query(Painting.class, qualifier3);
-        List<Painting> paintings3 = context.select(select3);
+        List<Painting> paintings3 = ObjectSelect.query(Painting.class)
+                .where(Painting.ARTIST.dot(Artist.DATE_OF_BIRTH)
+                        .lt(LocalDate.of(1900,1,1))).select(context);
     }
 
     static void deleteTutorial(ObjectContext context) {
         // Delete object examples
-        Expression qualifier = Artist.NAME.eq("Pablo Picasso");
-        SelectQuery<Artist> selectToDelete = SelectQuery.query(Artist.class, qualifier);
-        Artist picasso = (Artist) Cayenne.objectForQuery(context, selectToDelete);
+        Artist picasso = ObjectSelect.query(Artist.class)
+                .where(Artist.NAME.eq("Pablo Picasso")).selectOne(context);
 
         if (picasso != null) {
             context.deleteObjects(picasso);

http://git-wip-us.apache.org/repos/asf/cayenne/blob/347e504c/tutorials/tutorial/src/main/java/org/apache/cayenne/tutorial/persistent/Artist.java
----------------------------------------------------------------------
diff --git a/tutorials/tutorial/src/main/java/org/apache/cayenne/tutorial/persistent/Artist.java
b/tutorials/tutorial/src/main/java/org/apache/cayenne/tutorial/persistent/Artist.java
index 8846edc..318ceb0 100644
--- a/tutorials/tutorial/src/main/java/org/apache/cayenne/tutorial/persistent/Artist.java
+++ b/tutorials/tutorial/src/main/java/org/apache/cayenne/tutorial/persistent/Artist.java
@@ -18,9 +18,9 @@
  ****************************************************************/
 package org.apache.cayenne.tutorial.persistent;
 
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.Date;
+import java.time.LocalDate;
+import java.time.format.DateTimeFormatter;
+import java.time.format.DateTimeParseException;
 
 import org.apache.cayenne.tutorial.persistent.auto._Artist;
 
@@ -36,16 +36,14 @@ public class Artist extends _Artist {
 			setDateOfBirth(null);
 		} else {
 
-			Date date;
+			LocalDate date;
 			try {
-				date = new SimpleDateFormat(DEFAULT_DATE_FORMAT)
-						.parse(yearMonthDay);
-			} catch (ParseException e) {
-				throw new IllegalArgumentException(
-						"A date argument must be in format '"
-								+ DEFAULT_DATE_FORMAT + "': " + yearMonthDay);
+				DateTimeFormatter formatter = DateTimeFormatter.ofPattern(DEFAULT_DATE_FORMAT);
+				date = LocalDate.parse(yearMonthDay, formatter);
+			} catch (DateTimeParseException e) {
+				throw new IllegalArgumentException("A date argument must be in format '"
+						+ DEFAULT_DATE_FORMAT + "': " + yearMonthDay);
 			}
-
 			setDateOfBirth(date);
 		}
 	}

http://git-wip-us.apache.org/repos/asf/cayenne/blob/347e504c/tutorials/tutorial/src/main/java/org/apache/cayenne/tutorial/persistent/auto/_Artist.java
----------------------------------------------------------------------
diff --git a/tutorials/tutorial/src/main/java/org/apache/cayenne/tutorial/persistent/auto/_Artist.java
b/tutorials/tutorial/src/main/java/org/apache/cayenne/tutorial/persistent/auto/_Artist.java
index 93797c8..147f9f7 100644
--- a/tutorials/tutorial/src/main/java/org/apache/cayenne/tutorial/persistent/auto/_Artist.java
+++ b/tutorials/tutorial/src/main/java/org/apache/cayenne/tutorial/persistent/auto/_Artist.java
@@ -1,6 +1,6 @@
 package org.apache.cayenne.tutorial.persistent.auto;
 
-import java.util.Date;
+import java.time.LocalDate;
 import java.util.List;
 
 import org.apache.cayenne.CayenneDataObject;
@@ -19,15 +19,15 @@ public abstract class _Artist extends CayenneDataObject {
 
     public static final String ID_PK_COLUMN = "ID";
 
-    public static final Property<Date> DATE_OF_BIRTH = Property.create("dateOfBirth",
Date.class);
+    public static final Property<LocalDate> DATE_OF_BIRTH = Property.create("dateOfBirth",
LocalDate.class);
     public static final Property<String> NAME = Property.create("name", String.class);
     public static final Property<List<Painting>> PAINTINGS = Property.create("paintings",
List.class);
 
-    public void setDateOfBirth(Date dateOfBirth) {
+    public void setDateOfBirth(LocalDate dateOfBirth) {
         writeProperty("dateOfBirth", dateOfBirth);
     }
-    public Date getDateOfBirth() {
-        return (Date)readProperty("dateOfBirth");
+    public LocalDate getDateOfBirth() {
+        return (LocalDate)readProperty("dateOfBirth");
     }
 
     public void setName(String name) {

http://git-wip-us.apache.org/repos/asf/cayenne/blob/347e504c/tutorials/tutorial/src/main/resources/datamap.map.xml
----------------------------------------------------------------------
diff --git a/tutorials/tutorial/src/main/resources/datamap.map.xml b/tutorials/tutorial/src/main/resources/datamap.map.xml
index bcd43b8..d7a4ff0 100644
--- a/tutorials/tutorial/src/main/resources/datamap.map.xml
+++ b/tutorials/tutorial/src/main/resources/datamap.map.xml
@@ -20,7 +20,7 @@
 		<db-attribute name="NAME" type="VARCHAR" length="200"/>
 	</db-entity>
 	<obj-entity name="Artist" className="org.apache.cayenne.tutorial.persistent.Artist" dbEntityName="ARTIST">
-		<obj-attribute name="dateOfBirth" type="java.util.Date" db-attribute-path="DATE_OF_BIRTH"/>
+		<obj-attribute name="dateOfBirth" type="java.time.LocalDate" db-attribute-path="DATE_OF_BIRTH"/>
 		<obj-attribute name="name" type="java.lang.String" db-attribute-path="NAME"/>
 	</obj-entity>
 	<obj-entity name="Gallery" className="org.apache.cayenne.tutorial.persistent.Gallery"
dbEntityName="GALLERY">

http://git-wip-us.apache.org/repos/asf/cayenne/blob/347e504c/tutorials/tutorial/src/main/webapp/detail.jsp
----------------------------------------------------------------------
diff --git a/tutorials/tutorial/src/main/webapp/detail.jsp b/tutorials/tutorial/src/main/webapp/detail.jsp
index d012be0..448a8eb 100644
--- a/tutorials/tutorial/src/main/webapp/detail.jsp
+++ b/tutorials/tutorial/src/main/webapp/detail.jsp
@@ -22,6 +22,7 @@
 <%@ page import="org.apache.cayenne.tutorial.persistent.*" %>
 <%@ page import="org.apache.cayenne.*" %>
 <%@ page import="java.text.*" %>
+<%@ page import="java.time.format.DateTimeFormatter"%>
 
 <% 
     ObjectContext context = BaseContext.getThreadObjectContext();
@@ -56,8 +57,9 @@
     }
 
     String name = artist.getName() == null ? "" : artist.getName();
+    DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd");
     String dob = artist.getDateOfBirth() == null
-            ? "" : new SimpleDateFormat("yyyyMMdd").format(artist.getDateOfBirth());
+                            ? "" :artist.getDateOfBirth().format(formatter);
 %>
 <html>
     <head>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/347e504c/tutorials/tutorial/src/main/webapp/index.jsp
----------------------------------------------------------------------
diff --git a/tutorials/tutorial/src/main/webapp/index.jsp b/tutorials/tutorial/src/main/webapp/index.jsp
index b2de13e..36f630e 100644
--- a/tutorials/tutorial/src/main/webapp/index.jsp
+++ b/tutorials/tutorial/src/main/webapp/index.jsp
@@ -22,14 +22,14 @@
 <%@ page import="org.apache.cayenne.tutorial.persistent.*" %>
 <%@ page import="org.apache.cayenne.*" %>
 <%@ page import="org.apache.cayenne.query.*" %>
+<%@ page import="org.apache.cayenne.exp.*" %>
 <%@ page import="java.util.*" %>
 
-<% 
-    SelectQuery query = new SelectQuery(Artist.class);
-    query.addOrdering(Artist.NAME.getName(), SortOrder.ASCENDING);
-
+<%
     ObjectContext context = BaseContext.getThreadObjectContext();
-    List<Artist> artists = context.performQuery(query);
+    List<Artist> artists = ObjectSelect.query(Artist.class)
+                .orderBy(Artist.NAME.asc())
+                .select(context);
 %>
 <html>
     <head>


Mime
View raw message