mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-15 12:25:50 +00:00
Using jodatime LocalDate instead of DateTime for visits
This commit is contained in:
parent
19d7767318
commit
e00dfb3fe0
2 changed files with 8 additions and 8 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue