mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-17 04:55:50 +00:00
remove dependency with joda time to simplify the project dependencies
This commit is contained in:
parent
175cf7dfac
commit
8c4e274914
2 changed files with 27 additions and 28 deletions
|
@ -15,11 +15,9 @@
|
|||
*/
|
||||
package org.springframework.samples.petclinic.model;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import org.springframework.beans.support.MutableSortDefinition;
|
||||
import org.springframework.beans.support.PropertyComparator;
|
||||
|
||||
import javax.persistence.CascadeType;
|
||||
import javax.persistence.Column;
|
||||
|
@ -29,13 +27,14 @@ import javax.persistence.JoinColumn;
|
|||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.OneToMany;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import org.hibernate.annotations.Type;
|
||||
import org.joda.time.DateTime;
|
||||
import org.springframework.beans.support.MutableSortDefinition;
|
||||
import org.springframework.beans.support.PropertyComparator;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import javax.persistence.Temporal;
|
||||
import javax.persistence.TemporalType;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Simple business object representing a pet.
|
||||
|
@ -49,8 +48,8 @@ import com.fasterxml.jackson.annotation.JsonIgnore;
|
|||
public class Pet extends NamedEntity {
|
||||
|
||||
@Column(name = "birth_date")
|
||||
@Type(type = "org.jadira.usertype.dateandtime.joda.PersistentDateTime")
|
||||
private DateTime birthDate;
|
||||
@Temporal(TemporalType.DATE)
|
||||
private Date birthDate;
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "type_id")
|
||||
|
@ -65,11 +64,11 @@ public class Pet extends NamedEntity {
|
|||
private Set<Visit> visits;
|
||||
|
||||
|
||||
public void setBirthDate(DateTime birthDate) {
|
||||
public void setBirthDate(Date birthDate) {
|
||||
this.birthDate = birthDate;
|
||||
}
|
||||
|
||||
public DateTime getBirthDate() {
|
||||
public Date getBirthDate() {
|
||||
return this.birthDate;
|
||||
}
|
||||
|
||||
|
|
|
@ -15,18 +15,18 @@
|
|||
*/
|
||||
package org.springframework.samples.petclinic.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import org.hibernate.validator.constraints.NotEmpty;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import org.hibernate.annotations.Type;
|
||||
import org.hibernate.validator.constraints.NotEmpty;
|
||||
import org.joda.time.DateTime;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import javax.persistence.Temporal;
|
||||
import javax.persistence.TemporalType;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* Simple JavaBean domain object representing a visit.
|
||||
|
@ -41,9 +41,9 @@ public class Visit extends BaseEntity {
|
|||
* Holds value of property date.
|
||||
*/
|
||||
@Column(name = "visit_date")
|
||||
@Type(type = "org.jadira.usertype.dateandtime.joda.PersistentDateTime")
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
@DateTimeFormat(pattern = "yyyy/MM/dd")
|
||||
private DateTime date;
|
||||
private Date date;
|
||||
|
||||
/**
|
||||
* Holds value of property description.
|
||||
|
@ -65,7 +65,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 Date();
|
||||
}
|
||||
|
||||
|
||||
|
@ -74,7 +74,7 @@ public class Visit extends BaseEntity {
|
|||
*
|
||||
* @return Value of property date.
|
||||
*/
|
||||
public DateTime getDate() {
|
||||
public Date getDate() {
|
||||
return this.date;
|
||||
}
|
||||
|
||||
|
@ -83,7 +83,7 @@ public class Visit extends BaseEntity {
|
|||
*
|
||||
* @param date New value of property date.
|
||||
*/
|
||||
public void setDate(DateTime date) {
|
||||
public void setDate(Date date) {
|
||||
this.date = date;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue