diff --git a/mivan/src/main/java/mivan/model/Loan.java b/mivan/src/main/java/mivan/model/Loan.java index 34f2e45..f4dade9 100644 --- a/mivan/src/main/java/mivan/model/Loan.java +++ b/mivan/src/main/java/mivan/model/Loan.java @@ -1,7 +1,10 @@ package mivan.model; import javax.persistence.Column; +import javax.persistence.FetchType; import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; public class Loan { @@ -19,6 +22,18 @@ 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; @@ -59,5 +74,29 @@ 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; + } + + public void setStaff(Staff staff) { + this.staff = staff; + } + + public void setUser(User user) { + this.user = user; + } + }