From d9e90f08743058267c7c70ab3cd901b4cce564c7 Mon Sep 17 00:00:00 2001 From: grata Date: Fri, 5 May 2023 09:27:59 +0200 Subject: [PATCH] fixed get WaypointsVisited --- .../progetto152/entity/WaypointsVisitedEntity.java | 4 ++-- src/main/resources/mysql.sql | 13 ++++++++----- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/main/java/ch/progetto152/entity/WaypointsVisitedEntity.java b/src/main/java/ch/progetto152/entity/WaypointsVisitedEntity.java index 7504f46..4d903e2 100644 --- a/src/main/java/ch/progetto152/entity/WaypointsVisitedEntity.java +++ b/src/main/java/ch/progetto152/entity/WaypointsVisitedEntity.java @@ -15,10 +15,10 @@ import java.util.Objects; @IdClass(WaypointsVisitedId.class) public class WaypointsVisitedEntity { @Id - @Column(name = "userId") + @Column(name = "user_id") private int userId; @Id - @Column(name = "waypointId") + @Column(name = "waypoint_id") private int waypointId; @Override diff --git a/src/main/resources/mysql.sql b/src/main/resources/mysql.sql index ab76d35..aec0811 100644 --- a/src/main/resources/mysql.sql +++ b/src/main/resources/mysql.sql @@ -35,12 +35,12 @@ create table if not exists User primary key (id) ); -create table if not exists WaypointsVisited +create table if not exists Waypoints_visited ( - userId int not null, - waypointId int not null, - foreign key (userId) references User (id), - foreign key (waypointId) references Waypoints (id) + user_id int not null, + waypoint_id int not null, + foreign key (user_id) references User (id), + foreign key (waypoint_id) references Waypoints (id) ); @@ -102,3 +102,6 @@ values ('luca.bianchi', 'password'); insert into User (username, password) values ('giovanni.verdi', 'password'); insert into User (username, password, admin) values ('Joe', 'admin', true); + +insert into Waypoints_visited (user_id, waypoint_id) values (1,1); +insert into Waypoints_visited (user_id, waypoint_id) values (2,2); \ No newline at end of file