I work with Spring and got the entity below
package be.simonwyns.webapplicatie.model;import jakarta.persistence.*;@Entitypublic class Goal { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private int id; @ManyToOne private Game game; @ManyToOne private Player scorer; @ManyToOne private Player assistant; public Goal() { } public Goal(Game game, Player scorer, Player assistant) { this.game = game; this.scorer = scorer; this.assistant = assistant; } public Goal(Game game, Player scorer) { this.game = game; this.scorer = scorer; } public int getId() { return id; } public void setId(int id) { this.id = id; } public Game getGame() { return game; }and all the other constructors of course}
I also wanted to add the minute that the goal is scored so I added: private int minute;
public Goal(Game game, Player scorer, Player assistant, int minute) { this.game = game; this.scorer = scorer; this.assistant = assistant; this.minute = minute; }
and getter and setter:
public int getMinute() { return minute; } public void setMinute(int minute) { this.minute = minute; }
But now when I reload the application I get the errer that the table Goal is not found. Caused by: org.h2.jdbc.JdbcSQLSyntaxErrorException: Table "GOAL" not found; SQL statement:How is this possible by just adding one extra column to the table?