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