我認爲這可能是這可能dupplicate:Schema-validation: missing table [hibernate_sequences],但我無法弄清楚。模式的驗證:缺少表[遊戲]
所以在我application.properties
文件我有這個選項:spring.jpa.hibernate.ddl-auto=validate
和我收到此錯誤:
Schema-validation: missing table [game]
爲什麼我收到這個?
這是我Game
類和User
類:
遊戲:
@Entity
public class Game {
@Id
@Column(name = "GAME_NUMBER")
@GeneratedValue(strategy = GenerationType.SEQUENCE)
private long gameNumber;
private int playerScore;
private int NPCScore;
private Date datetime;
@ManyToOne
@JoinColumn(name="USER_ID")
private User user;
public Game() {}
public Game(int playerScore, int nPCScore, Date datetime) {
super();
this.playerScore = playerScore;
this.NPCScore = nPCScore;
this.datetime = datetime;
}
public User getUser() {
return user;
}
} + getters & setters
用戶:
@Entity
public class User {
@Id
@Column(name = "USER_ID")
@GeneratedValue(strategy = GenerationType.SEQUENCE)
private long userId;
private String username;
private String password;
@OneToMany(mappedBy="user",cascade=CascadeType.ALL)
private List<Game> games;
@ElementCollection
private List<Date> startSessions;
public User() {}
public User(String username, String password, List<Game> games, List<Date> startSessions) {
super();
this.username = username;
this.password = password;
this.games = games;
this.startSessions = startSessions;
}
}
我解決了問題,並創建表[遊戲],現在它工作正常。 – Rares
您可以檢查這個問題PLZ? https://stackoverflow.com/q/44485076/7947794 – Rares