From b9dfb8e48be363260ae332fdbb95d14bfb8c3562 Mon Sep 17 00:00:00 2001 From: "@Territory91" Date: Mon, 13 Jan 2020 01:18:17 +0100 Subject: [PATCH] Update Loan.java --- mivan/src/main/java/mivan/model/Loan.java | 63 ++++++++++++----------- 1 file changed, 32 insertions(+), 31 deletions(-) diff --git a/mivan/src/main/java/mivan/model/Loan.java b/mivan/src/main/java/mivan/model/Loan.java index f4dade9..0e2b844 100644 --- a/mivan/src/main/java/mivan/model/Loan.java +++ b/mivan/src/main/java/mivan/model/Loan.java @@ -9,11 +9,11 @@ import javax.persistence.ManyToOne; public class Loan { private static final long serialVersionUID = -5124436115031696628L; - + @Id - @Column(name = "id", nullable=false, unique=true) + @Column(name = "id", nullable = false, unique = true) private long id; - + @Column(name = "date_start", nullable = false) private String date_start; @@ -22,24 +22,26 @@ public class Loan { @Column(name = "state", nullable = false) private String state; - - @ManyToOne(fetch=FetchType.LAZY) - @JoinColumn(name="item") - private Item item; - - @ManyToOne(fetch=FetchType.LAZY) - @JoinColumn(name="staff") - private Staff staff; - - @ManyToOne(fetch=FetchType.LAZY) - @JoinColumn(name="user") - private User user; - - public Loan(long id, String date_start, String date_end, String state) { - this.id = id; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "item") + private Item item; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "staff") + private Staff staff; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "user") + private User user; + + public Loan(String date_start, String date_end, String state, Item item, Staff staff, User user) { this.date_start = date_start; this.date_end = date_end; this.state = state; + this.item = item; + this.staff = staff; + this.user = user; } public long getId() { @@ -58,6 +60,18 @@ public class Loan { return state; } + public Item getItem() { + return item; + } + + public Staff getStaff() { + return staff; + } + + public User getUser() { + return user; + } + public void setId(long id) { this.id = id; } @@ -74,18 +88,6 @@ public class Loan { this.state = state; } - public Item getItem() { - return item; - } - - public Staff getStaff() { - return staff; - } - - public User getUser() { - return user; - } - public void setItem(Item item) { this.item = item; } @@ -98,5 +100,4 @@ public class Loan { this.user = user; } - }