71 lines
1.1 KiB
Java
71 lines
1.1 KiB
Java
package com.example.servicedemo.model;
|
|
|
|
import java.util.Date;
|
|
|
|
import javax.persistence.*;
|
|
|
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
|
|
|
@Entity
|
|
@Table(name = "events")
|
|
public class Event {
|
|
|
|
@Id
|
|
@GeneratedValue(strategy = GenerationType.AUTO)
|
|
private long id;
|
|
|
|
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
|
@Column(name = "date")
|
|
private Date when;
|
|
|
|
@Column(name = "description")
|
|
private String what;
|
|
|
|
@Column(name = "location")
|
|
private String where;
|
|
|
|
public Event() {
|
|
|
|
}
|
|
|
|
public Event(Date when, String what, String where) {
|
|
this.when = when;
|
|
this.what = what;
|
|
this.where = where;
|
|
}
|
|
|
|
public long getId() {
|
|
return id;
|
|
}
|
|
|
|
public Date getWhen() {
|
|
return when;
|
|
}
|
|
|
|
public String getWhat() {
|
|
return what;
|
|
}
|
|
|
|
public String getWhere() {
|
|
return where;
|
|
}
|
|
|
|
public void setWhen(Date when) {
|
|
this.when = when;
|
|
}
|
|
|
|
public void setWhat(String what) {
|
|
this.what = what;
|
|
}
|
|
|
|
public void setWhere(String where) {
|
|
this.where = where;
|
|
}
|
|
|
|
@Override
|
|
public String toString() {
|
|
return "Event [id = " + id + ", when = " + when + ", what = " + what + ", where = " + where + "]";
|
|
}
|
|
|
|
}
|