From 5acca4d10d0e4de04c7be8b1b355a9e5ebf30401 Mon Sep 17 00:00:00 2001 From: Bartha Maxime <231026@umons.ac.be> Date: Wed, 6 Mar 2024 17:37:06 +0100 Subject: [PATCH] added foreign key to user --- .../java/ovh/herisson/Clyde/Tables/Token.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/backend/src/main/java/ovh/herisson/Clyde/Tables/Token.java b/backend/src/main/java/ovh/herisson/Clyde/Tables/Token.java index ec59cbf..5b61cb9 100644 --- a/backend/src/main/java/ovh/herisson/Clyde/Tables/Token.java +++ b/backend/src/main/java/ovh/herisson/Clyde/Tables/Token.java @@ -8,12 +8,13 @@ public class Token { @Id private int id; + @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name ="Users") - private int regNo; + private User user; private String token; - public Token(int regNo, String token){ - this.regNo = regNo; + public Token(User user, String token){ + this.user = user; this.token = token; } @@ -21,13 +22,12 @@ public class Token { public int getId() { return id; } - - public int getRegNo() { - return regNo; + public User getUser() { + return user; } - public void setRegNo(int regNo) { - this.regNo = regNo; + public void setUser(User regNo) { + this.user = regNo; } public String getToken(){