From e00dfb3fe05cef910495b38d5a24221188e2e1a6 Mon Sep 17 00:00:00 2001
From: Tomas Repel <trepel@redhat.com>
Date: Mon, 2 Nov 2015 10:51:04 +0100
Subject: [PATCH] Using jodatime LocalDate instead of DateTime for visits

---
 .../samples/petclinic/model/Visit.java               | 12 ++++++------
 .../repository/jdbc/JdbcVisitRowMapper.java          |  4 ++--
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/main/java/org/springframework/samples/petclinic/model/Visit.java b/src/main/java/org/springframework/samples/petclinic/model/Visit.java
index ea03bde..023a8dc 100644
--- a/src/main/java/org/springframework/samples/petclinic/model/Visit.java
+++ b/src/main/java/org/springframework/samples/petclinic/model/Visit.java
@@ -23,7 +23,7 @@ import javax.persistence.Table;
 
 import org.hibernate.annotations.Type;
 import org.hibernate.validator.constraints.NotEmpty;
-import org.joda.time.DateTime;
+import org.joda.time.LocalDate;
 import org.springframework.format.annotation.DateTimeFormat;
 
 /**
@@ -39,9 +39,9 @@ public class Visit extends BaseEntity {
      * Holds value of property date.
      */
     @Column(name = "visit_date")
-    @Type(type = "org.jadira.usertype.dateandtime.joda.PersistentDateTime")
+    @Type(type = "org.jadira.usertype.dateandtime.joda.PersistentLocalDate")
     @DateTimeFormat(pattern = "yyyy/MM/dd")
-    private DateTime date;
+    private LocalDate date;
 
     /**
      * Holds value of property description.
@@ -62,7 +62,7 @@ public class Visit extends BaseEntity {
      * Creates a new instance of Visit for the current date
      */
     public Visit() {
-        this.date = new DateTime();
+        this.date = new LocalDate();
     }
 
 
@@ -71,7 +71,7 @@ public class Visit extends BaseEntity {
      *
      * @return Value of property date.
      */
-    public DateTime getDate() {
+    public LocalDate getDate() {
         return this.date;
     }
 
@@ -80,7 +80,7 @@ public class Visit extends BaseEntity {
      *
      * @param date New value of property date.
      */
-    public void setDate(DateTime date) {
+    public void setDate(LocalDate date) {
         this.date = date;
     }
 
diff --git a/src/main/java/org/springframework/samples/petclinic/repository/jdbc/JdbcVisitRowMapper.java b/src/main/java/org/springframework/samples/petclinic/repository/jdbc/JdbcVisitRowMapper.java
index 9406904..edc4527 100644
--- a/src/main/java/org/springframework/samples/petclinic/repository/jdbc/JdbcVisitRowMapper.java
+++ b/src/main/java/org/springframework/samples/petclinic/repository/jdbc/JdbcVisitRowMapper.java
@@ -16,7 +16,7 @@
 package org.springframework.samples.petclinic.repository.jdbc;
 
 
-import org.joda.time.DateTime;
+import org.joda.time.LocalDate;
 import org.springframework.jdbc.core.RowMapper;
 import org.springframework.samples.petclinic.model.Visit;
 
@@ -35,7 +35,7 @@ class JdbcVisitRowMapper implements RowMapper<Visit> {
         Visit visit = new Visit();
         visit.setId(rs.getInt("visit_id"));
         Date visitDate = rs.getDate("visit_date");
-        visit.setDate(new DateTime(visitDate));
+        visit.setDate(new LocalDate(visitDate));
         visit.setDescription(rs.getString("description"));
         return visit;
     }
-- 
GitLab